def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: original_params: a dict with params for this View """ from soc.views.models import program as program_view rights = access.Checker(params) rights['any_access'] = ['allow'] rights['show'] = ['allow'] rights['create'] = ['checkIsDeveloper'] rights['edit'] = [('checkHasRoleForKeyFieldsAsScope', org_admin_logic.logic,), ('checkGroupIsActiveForLinkId', org_logic.logic)] rights['delete'] = ['checkIsDeveloper'] rights['home'] = ['allow'] rights['public_list'] = ['allow'] rights['apply_mentor'] = ['checkIsUser'] rights['list_requests'] = [('checkHasRoleForKeyFieldsAsScope', org_admin_logic.logic)] rights['list_roles'] = [('checkHasRoleForKeyFieldsAsScope', org_admin_logic.logic)] new_params = {} new_params['logic'] = soc.logic.models.organization.logic new_params['rights'] = rights new_params['scope_view'] = program_view new_params['scope_redirect'] = redirects.getCreateRedirect new_params['name'] = "Organization" new_params['url_name'] = "org" new_params['document_prefix'] = "org" new_params['sidebar_grouping'] = 'Organizations' new_params['public_template'] = 'soc/organization/public.html' new_params['home_template'] = 'soc/organization/home.html' new_params['sans_link_id_public_list'] = True patterns = [] patterns += [ (r'^%(url_name)s/(?P<access_type>apply_mentor)/%(scope)s$', '%(module_package)s.%(module_name)s.apply_mentor', "List of all %(name_plural)s you can apply to"), (r'^%(url_name)s/(?P<access_type>list_proposals)/%(key_fields)s$', '%(module_package)s.%(module_name)s.list_proposals', "List of all Student Proposals for "), (r'^%(url_name)s/(?P<access_type>applicant)/%(scope)s$', '%(module_package)s.%(module_name)s.applicant', "%(name)s Creation via Accepted Application"), ] new_params['extra_django_patterns'] = patterns new_params['create_dynafields'] = [ {'name': 'link_id', 'base': forms.fields.CharField, 'label': 'Organization Link ID', }, ] new_params['create_extra_dynaproperties'] = { 'scope_path': forms.CharField(widget=forms.HiddenInput, required=True), 'description': forms.fields.CharField( widget=helper.widgets.FullTinyMCE( attrs={'rows': 25, 'cols': 100})), 'clean_description': cleaning.clean_html_content('description'), 'clean_ideas': cleaning.clean_url('ideas'), 'clean': cleaning.validate_new_group('link_id', 'scope_path', soc.logic.models.organization), } new_params['edit_extra_dynaproperties'] = { 'clean': cleaning.clean_refs(params if params else new_params, ['home_link_id']) } new_params['public_field_extra'] = lambda entity: { 'ideas': lists.urlize(entity.ideas, 'Click Here'), } params = dicts.merge(params, new_params, sub_merge=True) super(View, self).__init__(params=params) self._params['public_field_keys'] = self._params['select_field_keys'] = [ "name", "link_id", "short_name", "ideas" ] self._params['public_field_names'] = self._params['select_field_names'] = [ "Name", "Link ID", "Short Name", "Ideas Page" ] self._params['select_field_extra'] = self._params['public_field_extra'] self._params['select_row_action'] = { "type": "redirect_custom", "parameters": dict(new_window=True), } self._params['select_row_extra'] = lambda entity: { "link": redirects.getRequestRedirectForRole( entity, params['mentor_url_name']) }
def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View """ # TODO(ljvderijk): phase out this module + access checks rights = access.Checker(params) rights['create'] = ['checkIsDeveloper'] rights['delete'] = [('checkCanEditGroupApp', [org_app_logic.logic]), ('checkIsActivePeriod', ['org_signup', 'scope_path', program_logic.logic])] rights['edit'] = [('checkCanEditGroupApp', [org_app_logic.logic]), ('checkIsActivePeriod', ['org_signup', 'scope_path', program_logic.logic])] rights['list'] = ['checkIsDeveloper'] rights['list_self'] = ['checkIsUser'] rights['show'] = ['allow'] rights['review'] = [ 'checkIsHostForProgramInScope', ('checkCanReviewGroupApp', [org_app_logic.logic]) ] rights['review_overview'] = ['checkIsHostForProgramInScope'] rights['bulk_accept'] = ['checkIsHostForProgramInScope'] rights['bulk_reject'] = ['checkIsHostForProgramInScope'] rights['apply'] = [ 'checkIsUser', ('checkCanCreateOrgApp', ['org_signup', program_logic.logic]), ('checkIsNotStudentForProgramInScope', [program_logic.logic, student_logic.logic]) ] new_params = {} new_params['rights'] = rights new_params['logic'] = org_app_logic.logic new_params['scope_view'] = program_view new_params['scope_redirect'] = redirects.getCreateRedirect new_params['sidebar_grouping'] = 'Organizations' new_params['list_key_order'] = [ 'link_id', 'scope_path', 'name', 'home_page', 'email', 'description', 'why_applying', 'pub_mailing_list', 'irc_channel', 'member_criteria', 'prior_participation', 'prior_application', 'license_name', 'ideas', 'dev_mailing_list', 'contrib_template', 'contrib_disappears', 'member_disappears', 'encourage_contribs', 'continued_contribs' ] patterns = [ (r'^%(url_name)s/(?P<access_type>apply)/%(scope)s$', 'soc.views.models.%(module_name)s.create', 'Create an %(name_plural)s'), (r'^%(url_name)s/(?P<access_type>bulk_accept)/%(scope)s$', 'soc.views.models.%(module_name)s.bulk_accept', 'Bulk Acceptation of %(name_plural)s'), (r'^%(url_name)s/(?P<access_type>bulk_reject)/%(scope)s$', 'soc.views.models.%(module_name)s.bulk_reject', 'Bulk Rejection of %(name_plural)s'), ] new_params['extra_django_patterns'] = patterns new_params['extra_key_order'] = [ 'admin_agreement', 'agreed_to_admin_agreement' ] new_params['extra_dynaexclude'] = [ 'applicant', 'backup_admin', 'status', 'created_on', 'last_modified_on' ] new_params['create_dynafields'] = [ { 'name': 'link_id', 'base': forms.fields.CharField, 'label': 'Organization Link ID', }, ] new_params['create_extra_dynaproperties'] = { 'scope_path': forms.fields.CharField(widget=forms.HiddenInput, required=True), 'contrib_template': forms.fields.CharField(widget=helper.widgets.FullTinyMCE( attrs={ 'rows': 25, 'cols': 100 })), 'description': forms.fields.CharField(widget=helper.widgets.FullTinyMCE( attrs={ 'rows': 25, 'cols': 100 })), 'admin_agreement': forms.fields.Field(required=False, widget=widgets.AgreementField), 'agreed_to_admin_agreement': forms.fields.BooleanField(initial=False, required=True), 'clean_description': cleaning.clean_html_content('description'), 'clean_contrib_template': cleaning.clean_html_content('contrib_template'), 'clean_ideas': cleaning.clean_url('ideas'), 'clean': cleaning.validate_new_group('link_id', 'scope_path', model_logic.organization, org_app_logic) } # get rid of the clean method new_params['edit_extra_dynaproperties'] = { 'clean': (lambda x: x.cleaned_data) } new_params['name'] = "Organization Application" new_params['name_plural'] = "Organization Applications" new_params['name_short'] = "Org App" new_params['url_name'] = "org_app" new_params['group_name'] = "Organization" new_params['group_url_name'] = 'org' new_params['review_template'] = 'soc/org_app/review.html' # TODO use a proper template that works for each program new_params['accepted_mail_template'] = \ 'soc/org_app/mail/accepted_gsoc2009.html' new_params['rejected_mail_template'] = 'soc/org_app/mail/rejected.html' params = dicts.merge(params, new_params) super(View, self).__init__(params=params)
def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: original_params: a dict with params for this View """ from soc.views.models import program as program_view rights = access.Checker(params) rights['any_access'] = ['allow'] rights['show'] = ['allow'] rights['create'] = ['checkIsDeveloper'] rights['edit'] = [('checkHasActiveRoleForKeyFieldsAsScope', org_admin_logic.logic,), ('checkGroupIsActiveForLinkId', org_logic.logic)] rights['delete'] = ['checkIsDeveloper'] rights['home'] = ['allow'] rights['public_list'] = ['allow'] rights['apply_mentor'] = ['checkIsUser'] rights['list_requests'] = [('checkHasActiveRoleForKeyFieldsAsScope', org_admin_logic.logic)] rights['list_roles'] = [('checkHasActiveRoleForKeyFieldsAsScope', org_admin_logic.logic)] rights['applicant'] = [('checkIsApplicationAccepted', org_app_logic.logic)] rights['list_proposals'] = [('checkHasAny', [ [('checkHasActiveRoleForKeyFieldsAsScope', [org_admin_logic.logic]), ('checkHasActiveRoleForKeyFieldsAsScope', [mentor_logic.logic])] ])] new_params = {} new_params['logic'] = soc.logic.models.organization.logic new_params['rights'] = rights new_params['scope_view'] = program_view new_params['scope_redirect'] = redirects.getCreateRedirect new_params['name'] = "Organization" new_params['url_name'] = "org" new_params['document_prefix'] = "org" new_params['sidebar_grouping'] = 'Organizations' new_params['public_template'] = 'soc/organization/public.html' new_params['list_row'] = 'soc/organization/list/row.html' new_params['list_heading'] = 'soc/organization/list/heading.html' new_params['home_template'] = 'soc/organization/home.html' new_params['application_logic'] = org_app_logic new_params['group_applicant_url'] = True new_params['sans_link_id_public_list'] = True new_params['extra_dynaexclude'] = ['slots', 'slots_calculated', 'nr_applications', 'nr_mentors'] patterns = [] patterns += [ (r'^%(url_name)s/(?P<access_type>apply_mentor)/%(scope)s$', 'soc.views.models.%(module_name)s.apply_mentor', "List of all %(name_plural)s you can apply to"), (r'^%(url_name)s/(?P<access_type>list_proposals)/%(key_fields)s$', 'soc.views.models.%(module_name)s.list_proposals', "List of all Student Proposals for this %(name)s"), ] new_params['extra_django_patterns'] = patterns new_params['create_dynafields'] = [ {'name': 'link_id', 'base': forms.fields.CharField, 'label': 'Organization Link ID', }, ] new_params['create_extra_dynaproperties'] = { 'scope_path': forms.CharField(widget=forms.HiddenInput, required=True), 'description': forms.fields.CharField( widget=helper.widgets.FullTinyMCE( attrs={'rows': 25, 'cols': 100})), 'contrib_template': forms.fields.CharField( widget=helper.widgets.FullTinyMCE( attrs={'rows': 25, 'cols': 100})), 'clean_description': cleaning.clean_html_content('description'), 'clean_contrib_template': cleaning.clean_html_content( 'contrib_template'), 'clean_ideas': cleaning.clean_url('ideas'), 'clean': cleaning.validate_new_group('link_id', 'scope_path', soc.logic.models.organization, org_app_logic) } new_params['edit_extra_dynaproperties'] = { 'clean': cleaning.clean_refs(new_params, ['home_link_id']) } params = dicts.merge(params, new_params) super(View, self).__init__(params=params) # create and store the special form for applicants updated_fields = { 'link_id': forms.CharField(widget=widgets.ReadOnlyInput(), required=False), 'clean_link_id': cleaning.clean_link_id('link_id') } applicant_create_form = dynaform.extendDynaForm( dynaform = self._params['create_form'], dynaproperties = updated_fields) self._params['applicant_create_form'] = applicant_create_form
def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View """ rights = access.Checker(params) rights['create'] = ['checkIsDeveloper'] rights['edit'] = [('checkHasRoleForLinkId', club_admin_logic.logic), ('checkGroupIsActiveForLinkId', club_logic.logic)] rights['delete'] = ['checkIsDeveloper'] rights['home'] = ['allow'] rights['list'] = ['checkIsDeveloper'] rights['apply_member'] = [ 'checkIsUser', ('checkGroupIsActiveForScopeAndLinkId', club_logic.logic) ] rights['list_requests'] = [('checkHasRoleForLinkId', club_admin_logic.logic)] rights['list_roles'] = [('checkHasRoleForLinkId', club_admin_logic.logic)] new_params = {} new_params['logic'] = soc.logic.models.club.logic new_params['rights'] = rights new_params['name'] = "Club" new_params['url_name'] = "club" new_params['document_prefix'] = "club" new_params['sidebar_grouping'] = 'Clubs' new_params['public_template'] = 'soc/group/public.html' patterns = [] patterns += [ (r'^%(url_name)s/(?P<access_type>apply_member)$', 'soc.views.models.%(module_name)s.apply_member', "List of all %(name_plural)s you can apply to"), ] new_params['extra_django_patterns'] = patterns new_params['sidebar_additional'] = [ ('/' + new_params['url_name'] + '/apply_member', 'Join a Club', 'apply_member'), ] new_params['create_dynafields'] = [ { 'name': 'link_id', 'base': forms.fields.CharField, 'label': 'Club Link ID', }, ] new_params['create_extra_dynaproperties'] = { 'clean': cleaning.validate_new_group('link_id', 'scope_path', club_logic, None) } # get rid of the clean method new_params['edit_extra_dynaproperties'] = { 'clean': (lambda x: x.cleaned_data) } new_params['public_field_keys'] = ["name", "link_id", "short_name"] new_params['public_field_names'] = ["Name", "Link ID", "Short name"] params = dicts.merge(params, new_params) super(View, self).__init__(params=params) # create and store the special form for applicants updated_fields = { 'link_id': forms.CharField(widget=widgets.ReadOnlyInput(), required=False), 'clean_link_id': cleaning.clean_link_id('link_id') } applicant_create_form = dynaform.extendDynaForm( dynaform=self._params['create_form'], dynaproperties=updated_fields) self._params['applicant_create_form'] = applicant_create_form
def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View """ rights = access.Checker(params) rights['any_access'] = ['allow'] rights['create'] = ['checkIsDeveloper'] rights['edit'] = [('checkHasRoleForLinkId', club_admin_logic.logic), ('checkGroupIsActiveForLinkId', club_logic.logic)] rights['delete'] = ['checkIsDeveloper'] rights['home'] = ['allow'] rights['list'] = ['checkIsDeveloper'] rights['apply_member'] = ['checkIsUser', ('checkGroupIsActiveForScopeAndLinkId', club_logic.logic)] rights['list_requests'] = [('checkHasRoleForLinkId', club_admin_logic.logic)] rights['list_roles'] = [('checkHasRoleForLinkId', club_admin_logic.logic)] new_params = {} new_params['logic'] = soc.logic.models.club.logic new_params['rights'] = rights new_params['name'] = "Club" new_params['url_name'] = "club" new_params['document_prefix'] = "club" new_params['sidebar_grouping'] = 'Clubs' new_params['public_template'] = 'soc/group/public.html' patterns = [] patterns += [(r'^%(url_name)s/(?P<access_type>apply_member)$', 'soc.views.models.%(module_name)s.apply_member', "List of all %(name_plural)s you can apply to"),] new_params['extra_django_patterns'] = patterns new_params['sidebar_additional'] = [ ('/' + new_params['url_name'] + '/apply_member', 'Join a Club', 'apply_member'),] new_params['create_dynafields'] = [ {'name': 'link_id', 'base': forms.fields.CharField, 'label': 'Club Link ID', }, ] new_params['create_extra_dynaproperties'] = { 'clean' : cleaning.validate_new_group('link_id', 'scope_path', club_logic)} # get rid of the clean method new_params['edit_extra_dynaproperties'] = { 'clean' : (lambda x: x.cleaned_data)} new_params['public_field_keys'] = ["name", "link_id", "short_name"] new_params['public_field_names'] = ["Name", "Link ID", "Short name"] params = dicts.merge(params, new_params) super(View, self).__init__(params=params) # create and store the special form for applicants updated_fields = { 'link_id': forms.CharField(widget=widgets.ReadOnlyInput(), required=False), 'clean_link_id': cleaning.clean_link_id('link_id')} applicant_create_form = dynaform.extendDynaForm( dynaform = self._params['create_form'], dynaproperties = updated_fields) self._params['applicant_create_form'] = applicant_create_form
def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View """ rights = access.Checker(params) rights['create'] = ['checkIsUser'] rights['delete'] = ['checkIsDeveloper'] rights['edit'] = [('checkCanEditGroupApp', [club_app_logic.logic])] rights['list'] = ['checkIsDeveloper'] rights['list_self'] = ['checkIsUser'] rights['show'] = [('checkCanEditGroupApp', [club_app_logic.logic])] # TODO(ljvderijk) make sure host role check is fixed rights['review'] = [('checkHasActiveRoleForScope', host_logic.logic), ('checkCanReviewGroupApp', [club_app_logic.logic])] rights['review_overview'] = [('checkHasActiveRoleForScope', host_logic.logic)] new_params = {} new_params['rights'] = rights new_params['logic'] = club_app_logic.logic new_params['sidebar_grouping'] = 'Clubs' new_params['create_dynafields'] = [ {'name': 'link_id', 'base': forms.fields.CharField, 'label': 'Club Link ID', }, ] new_params['create_extra_dynaproperties'] = { 'clean': cleaning.validate_new_group('link_id', 'scope_path', model_logic.club, club_app_logic)} # get rid of the clean method new_params['edit_extra_dynaproperties'] = { 'clean': (lambda x: x.cleaned_data)} new_params['name'] = "Club Application" new_params['name_plural'] = "Club Applications" new_params['name_short'] = "Club App" new_params['url_name'] = "club_app" new_params['group_name'] = "Club" new_params['group_url_name'] = 'club' new_params['review_template'] = 'soc/club_app/review.html' new_params['sidebar_additional'] = [ ('/%(url_name)s/list_self/' % new_params, 'List all my %(name_plural)s' % new_params, 'list_self'), ('/%(url_name)s/review_overview/' % new_params, 'Review %(name_plural)s' % new_params, 'review_overview')] params = dicts.merge(params, new_params) super(View, self).__init__(params=params)
def __init__(self, params=None): """Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View """ rights = access.Checker(params) rights['create'] = ['checkIsDeveloper'] rights['delete'] = [('checkCanEditGroupApp', [org_app_logic.logic]), ('checkIsActivePeriod', ['org_signup', 'scope_path'])] rights['edit'] = [('checkCanEditGroupApp', [org_app_logic.logic]), ('checkIsActivePeriod', ['org_signup', 'scope_path'])] rights['list'] = ['checkIsDeveloper'] rights['list_self'] = ['checkIsUser'] rights['show'] = ['allow'] rights['review'] = ['checkIsHostForProgramInScope', ('checkCanReviewGroupApp', [org_app_logic.logic])] rights['review_overview'] = ['checkIsHostForProgramInScope'] rights['bulk_accept'] = ['checkIsHostForProgramInScope'] rights['bulk_reject'] = ['checkIsHostForProgramInScope'] rights['apply'] = ['checkIsUser', ('checkCanCreateOrgApp', ['org_signup']), 'checkIsNotStudentForProgramInScope'] new_params = {} new_params['rights'] = rights new_params['logic'] = org_app_logic.logic new_params['scope_view'] = program_view new_params['scope_redirect'] = redirects.getCreateRedirect new_params['sidebar_grouping'] = 'Organizations' new_params['list_key_order'] = [ 'link_id', 'scope_path', 'name', 'home_page', 'email', 'description', 'why_applying','pub_mailing_list','irc_channel', 'member_criteria', 'prior_participation', 'prior_application', 'license_name', 'ideas', 'dev_mailing_list', 'contrib_template', 'contrib_disappears', 'member_disappears', 'encourage_contribs', 'continued_contribs'] patterns = [(r'^%(url_name)s/(?P<access_type>apply)/%(scope)s$', 'soc.views.models.%(module_name)s.create', 'Create an %(name_plural)s'), (r'^%(url_name)s/(?P<access_type>bulk_accept)/%(scope)s$', 'soc.views.models.%(module_name)s.bulk_accept', 'Bulk Acceptation of %(name_plural)s'), (r'^%(url_name)s/(?P<access_type>bulk_reject)/%(scope)s$', 'soc.views.models.%(module_name)s.bulk_reject', 'Bulk Rejection of %(name_plural)s'),] new_params['extra_django_patterns'] = patterns new_params['extra_key_order'] = ['admin_agreement', 'agreed_to_admin_agreement'] new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'status', 'created_on', 'last_modified_on'] new_params['create_dynafields'] = [ {'name': 'link_id', 'base': forms.fields.CharField, 'label': 'Organization Link ID', }, ] new_params['create_extra_dynaproperties'] = { 'scope_path': forms.fields.CharField(widget=forms.HiddenInput, required=True), 'contrib_template': forms.fields.CharField( widget=helper.widgets.FullTinyMCE( attrs={'rows': 25, 'cols': 100})), 'description': forms.fields.CharField( widget=helper.widgets.FullTinyMCE( attrs={'rows': 25, 'cols': 100})), 'admin_agreement': forms.fields.Field(required=False, widget=widgets.AgreementField), 'agreed_to_admin_agreement': forms.fields.BooleanField( initial=False, required=True), 'clean_description': cleaning.clean_html_content('description'), 'clean_contrib_template': cleaning.clean_html_content( 'contrib_template'), 'clean_ideas': cleaning.clean_url('ideas'), 'clean': cleaning.validate_new_group('link_id', 'scope_path', model_logic.organization, org_app_logic)} # get rid of the clean method new_params['edit_extra_dynaproperties'] = { 'clean': (lambda x: x.cleaned_data)} new_params['name'] = "Organization Application" new_params['name_plural'] = "Organization Applications" new_params['name_short'] = "Org App" new_params['url_name'] = "org_app" new_params['group_name'] = "Organization" new_params['group_url_name'] = 'org' new_params['review_template'] = 'soc/org_app/review.html' # TODO use a proper template that works for each program new_params['accepted_mail_template'] = \ 'soc/org_app/mail/accepted_gsoc2009.html' new_params['rejected_mail_template'] = 'soc/org_app/mail/rejected.html' params = dicts.merge(params, new_params) super(View, self).__init__(params=params)