| # Copyright 2014 the Melange authors. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| """Module with Code In-specific connection related views.""" |
| |
| from codein.request import error |
| from codein.request import render |
| from codein.views.helper import urls as ci_urls |
| |
| from melange.models import organization as org_model |
| from melange.request import access |
| from melange.request import links |
| from melange.views import connection as connection_view |
| |
| from soc.modules.gci.views import base |
| from soc.modules.gci.views import forms as gci_forms |
| from soc.modules.gci.views.helper import url_patterns as ci_url_patterns |
| |
| |
| CONNECTION_FORM_FACTORY = connection_view.ConnectionFormFactory( |
| gci_forms.GCIBoundField, gci_forms.TEMPLATE_PATH) |
| |
| LIST_CONNECTION_FOR_ORG_ADMIN = connection_view.ListConnectionsForOrgAdmin( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames, 'codein/connection/list_connections.html', '_list.html') |
| |
| LIST_CONNECTION_FOR_USER = connection_view.ListConnectionsForUser( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames, 'codein/connection/list_connections.html', '_list.html') |
| |
| MANAGE_CONNECTION_AS_ORG = connection_view.ManageConnectionAsOrg( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames, 'codein/connection/manage_connection_as_user.html', |
| CONNECTION_FORM_FACTORY) |
| |
| MANAGE_CONNECTION_AS_USER = connection_view.ManageConnectionAsUser( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames, 'codein/connection/manage_connection_as_user.html', |
| CONNECTION_FORM_FACTORY) |
| |
| MARK_CONNECTION_AS_SEEN_BY_USER = connection_view.MarkConnectionAsSeenByUser( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames) |
| |
| MARK_CONNECTION_AS_SEEN_BY_ORG = connection_view.MarkConnectionAsSeenByOrg( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames) |
| |
| PICK_ORGANIZATION_TO_CONNECT = connection_view.PickOrganizationToConnectPage( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames, 'modules/gci/accepted_orgs/base.html') |
| |
| START_CONNECTION_AS_ORG = connection_view.StartConnectionAsOrg( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames, 'modules/gci/form_base.html', CONNECTION_FORM_FACTORY) |
| |
| START_CONNECTION_AS_USER_ACCESS_CHECKER = access.ConjuctionAccessChecker([ |
| access.PROGRAM_ACTIVE_ACCESS_CHECKER, |
| access.NON_STUDENT_PROFILE_ACCESS_CHECKER, |
| access.UrlOrgStatusAccessChecker([org_model.Status.ACCEPTED]), |
| connection_view.NoConnectionExistsAccessChecker(ci_urls.UrlNames)]) |
| |
| START_CONNECTION_AS_USER = connection_view.StartConnectionAsUser( |
| base._GCI_INITIALIZER, links.LINKER, render.CI_RENDERER, |
| error.CI_ERROR_HANDLER, ci_url_patterns.CI_URL_PATTERN_CONSTRUCTOR, |
| ci_urls.UrlNames, 'modules/gci/form_base.html', |
| START_CONNECTION_AS_USER_ACCESS_CHECKER, CONNECTION_FORM_FACTORY) |