Author: adc Date: Sat Aug 9 21:48:11 2014 New Revision: 1617020 URL: http://svn.apache.org/r1617020 Log: Bootstrap v3.2.0
Added less files Added: labs/panopticon/pan-site/src/asf/panopticon/api/ labs/panopticon/pan-site/src/asf/panopticon/api/__init__.py labs/panopticon/pan-site/src/asf/panopticon/api/templates/ labs/panopticon/pan-site/src/asf/panopticon/api/templates/api_forbidden.html labs/panopticon/pan-site/src/asf/panopticon/foundation/ labs/panopticon/pan-site/src/asf/panopticon/foundation/__init__.py labs/panopticon/pan-site/src/asf/panopticon/foundation/templates/ labs/panopticon/pan-site/src/asf/panopticon/foundation/templates/foundation.html labs/panopticon/pan-site/src/asf/panopticon/infrastructure/ labs/panopticon/pan-site/src/asf/panopticon/infrastructure/__init__.py labs/panopticon/pan-site/src/asf/panopticon/infrastructure/templates/ labs/panopticon/pan-site/src/asf/panopticon/infrastructure/templates/infrastructure.html labs/panopticon/pan-site/src/asf/panopticon/podlings/ labs/panopticon/pan-site/src/asf/panopticon/podlings/__init__.py labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/ labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podling.html labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings.html labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_dashboard.html labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_setup.html labs/panopticon/pan-site/src/asf/panopticon/projects/ labs/panopticon/pan-site/src/asf/panopticon/projects/__init__.py labs/panopticon/pan-site/src/asf/panopticon/projects/templates/ labs/panopticon/pan-site/src/asf/panopticon/projects/templates/project.html labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_dashboard.html labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_setup.html labs/panopticon/pan-site/src/asf/panopticon/static/images/ labs/panopticon/pan-site/src/asf/panopticon/static/images/panopticon-background.jpg labs/panopticon/pan-site/src/asf/panopticon/static/js/jquery.parallax.min.js labs/panopticon/pan-site/src/asf/panopticon/static/less/ labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/ labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/alerts.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/badges.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/breadcrumbs.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/button-groups.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/buttons.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/carousel.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/close.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/code.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/component-animations.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/dropdowns.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/forms.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/glyphicons.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/grid.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/input-groups.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/jumbotron.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/labels.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/list-group.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/media.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/ labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/alerts.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/background-variant.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/border-radius.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/buttons.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/center-block.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/clearfix.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/forms.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/gradients.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/grid-framework.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/grid.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/hide-text.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/image.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/labels.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/list-group.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/nav-divider.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/nav-vertical-align.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/opacity.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/pagination.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/panels.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/progress-bar.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/reset-filter.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/resize.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/responsive-visibility.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/size.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/tab-focus.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/table-row.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/text-emphasis.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/text-overflow.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/mixins/vendor-prefixes.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/modals.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/navbar.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/navs.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/normalize.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/pager.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/pagination.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/panels.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/popovers.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/print.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/progress-bars.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/responsive-embed.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/responsive-utilities.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/scaffolding.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/tables.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/theme.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/thumbnails.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/tooltip.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/type.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/utilities.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/variables.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/boostrap/wells.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/bootstrap.less (with props) labs/panopticon/pan-site/src/asf/panopticon/static/less/panopticon/ labs/panopticon/pan-site/src/asf/panopticon/static/less/panopticon.less labs/panopticon/pan-site/src/asf/panopticon/static/less/panopticon/footer.less labs/panopticon/pan-site/src/asf/panopticon/static/less/panopticon/helper.less labs/panopticon/pan-site/src/asf/panopticon/static/less/panopticon/mixins.less labs/panopticon/pan-site/src/asf/panopticon/static/less/panopticon/nav.less labs/panopticon/pan-site/src/asf/panopticon/static/less/panopticon/splash.less labs/panopticon/pan-site/src/asf/panopticon/templates/privacy-policy.html labs/panopticon/pan-site/src/asf/panopticon/templates/setup.html Removed: labs/panopticon/pan-site/src/asf/panopticon/static/css/bootstrap.min.css Modified: labs/panopticon/pan-site/requirements.txt labs/panopticon/pan-site/src/asf/panopticon/__init__.py labs/panopticon/pan-site/src/asf/panopticon/static/css/bootstrap.css (contents, props changed) labs/panopticon/pan-site/src/asf/panopticon/static/css/panopticon.css labs/panopticon/pan-site/src/asf/panopticon/static/fonts/glyphicons-halflings-regular.eot labs/panopticon/pan-site/src/asf/panopticon/static/fonts/glyphicons-halflings-regular.svg labs/panopticon/pan-site/src/asf/panopticon/static/fonts/glyphicons-halflings-regular.ttf labs/panopticon/pan-site/src/asf/panopticon/static/fonts/glyphicons-halflings-regular.woff labs/panopticon/pan-site/src/asf/panopticon/static/js/bootstrap.js labs/panopticon/pan-site/src/asf/panopticon/static/js/bootstrap.min.js labs/panopticon/pan-site/src/asf/panopticon/static/js/user-popover.js labs/panopticon/pan-site/src/asf/panopticon/templates/error.html labs/panopticon/pan-site/src/asf/panopticon/templates/forbidden.html labs/panopticon/pan-site/src/asf/panopticon/templates/index.html labs/panopticon/pan-site/src/asf/panopticon/templates/layout.html labs/panopticon/pan-site/src/asf/panopticon/templates/not_found.html labs/panopticon/pan-utils/src/asf/data/projects.py Modified: labs/panopticon/pan-site/requirements.txt URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/requirements.txt?rev=1617020&r1=1617019&r2=1617020&view=diff ============================================================================== --- labs/panopticon/pan-site/requirements.txt (original) +++ labs/panopticon/pan-site/requirements.txt Sat Aug 9 21:48:11 2014 @@ -1,4 +1,6 @@ Flask==0.10.1 Flask-Principal==0.4.0 flask-memcache-session==2.0 +flask-MenuManager==1.0a2 python-memcached==1.53 +PyMemoize==1.0.1 \ No newline at end of file Modified: labs/panopticon/pan-site/src/asf/panopticon/__init__.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/__init__.py?rev=1617020&r1=1617019&r2=1617020&view=diff ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/__init__.py (original) +++ labs/panopticon/pan-site/src/asf/panopticon/__init__.py Sat Aug 9 21:48:11 2014 @@ -7,7 +7,7 @@ # "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 +# 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 @@ -19,45 +19,77 @@ import logging import flask -from flask.ext import principal +from flask.ext import principal, memcache_session +from flask.ext import MenuManager as menu +import memoize from werkzeug.contrib import cache -from flask.ext.memcache_session import Session -from asf.data import ldap -from asf.person import Person, PersonError +from asf import person +from asf.data import ldap as ldap_data +from asf.data import projects as project_data +from asf.incubator import podlings as podling_data +from asf.panopticon.api import api +from asf.panopticon.foundation import foundation +from asf.panopticon.infrastructure import infrastructure +from asf.panopticon.podlings import podlings +from asf.panopticon.projects import projects +from asf.utils import committers +# Make a store. + +store = {} + +# Initialize the cache object. +memo = memoize.Memoizer(store) app = flask.Flask(__name__) app.config.from_envvar('PANOPTICON_FLASK_CONFIG') +app.register_blueprint(api, url_prefix='/api') +app.register_blueprint(foundation, url_prefix='/foundation') +app.register_blueprint(infrastructure, url_prefix='/infrastructure') +app.register_blueprint(podlings, url_prefix='/podlings') +app.register_blueprint(projects, url_prefix='/projects') + app.cache = cache.MemcachedCache([app.config['SESSION_MEMCACHE_HOST']]) -app.session_interface = Session() +app.session_interface = memcache_session.Session() +menu.MenuManager(app=app) log = logging.getLogger(__name__) logging.basicConfig(level=logging.DEBUG) +@memo(max_age=360) +def memoized_get_pmcs(): + return project_data.get_pmcs() + + +@memo(max_age=360) +def memoized_get_podlings(): + return podling_data.get_podlings() + + +authenticated_permission = principal.Permission(principal.RoleNeed('authenticated')) + + @app.route('/') def hello_world(): - return flask.render_template('index.html') + num_projects = len(memoized_get_pmcs()) + num_podlings = len(podling_data.incubating(memoized_get_podlings().values())) + return flask.render_template('index.html', num_projects=num_projects, num_podlings=num_podlings) -@app.route('/api/users/<username>') -def user_info(username): - try: - person = Person(username) - except PersonError: - return flask.make_response(flask.Response('No Such User %s' % username, status=404)) - - return flask.jsonify({ - 'username': person.username, - 'fullname': person.fullname, - 'email': person.email, - 'email_string': person.email_string, - 'picture_url': person.picture_url, - }) +@app.route('/setup') +@authenticated_permission.require() +def render_setup(): + return flask.render_template('setup.html') + + +@app.route('/privacy-policy') +def render_privacy_policy(): + return flask.render_template('privacy-policy.html') @app.before_request @@ -72,8 +104,11 @@ def login(): username = flask.request.form.get('username') password = flask.request.form.get('password') - if ldap.check_user_password(username, password): - principal.identity_changed.send(app, identity=principal.Identity(username, auth_type='ldap')) + if ldap_data.check_user_password(username, password): + identity = principal.Identity(username, auth_type='ldap') + for p in committers.get_committer(username, username, password).projects: + identity.provides.add(principal.RoleNeed(p)) + principal.identity_changed.send(app, identity=identity) flask.flash(u'Signed in as ' + username, 'success') else: flask.flash(u'Invalid username or password', 'danger') @@ -81,10 +116,11 @@ def login(): @app.route('/logout') +@authenticated_permission.require() def logout(): principal.identity_changed.send(app, identity=principal.AnonymousIdentity()) flask.flash(u'You have been signed out', 'success') - return flask.redirect(flask.request.referrer) + return flask.redirect(flask.url_for('hello_world')) is_authenticated = principal.Permission(principal.RoleNeed('authenticated')) @@ -95,12 +131,15 @@ principals = principal.Principal(app, sk @principals.identity_loader def session_identity_loader(): - if 'identity.id' in flask.session and 'identity.auth_type' in flask.session: + if all(key in flask.session for key in ('identity.id', 'identity.auth_type', 'identity.projects')): identity_id = flask.session['identity.id'] identity_auth_type = flask.session['identity.auth_type'] + identity_projects = flask.session['identity.projects'] if identity_id: identity = principal.Identity(identity_id, identity_auth_type) + for p in identity_projects.split(','): + identity.provides.add(principal.RoleNeed(p)) else: identity = principal.AnonymousIdentity() return identity @@ -116,6 +155,7 @@ def session_identity_saver(identity): else: flask.session['identity.id'] = identity.id flask.session['identity.auth_type'] = identity.auth_type + flask.session['identity.projects'] = ','.join([role.value for role in identity.provides]) flask.session.modified = True @@ -126,8 +166,8 @@ def on_identity_changed(sender, identity identity.is_authenticated = not isinstance(identity, principal.AnonymousIdentity) if identity.is_authenticated: - person = Person(identity.id, fault_in_via_ldap=True) - identity.person = person + user = person.Person(identity.id, fault_in_via_ldap=True) + identity.person = user identity.provides.add(principal.RoleNeed('authenticated')) else: identity.person = None @@ -140,8 +180,8 @@ def on_identity_loaded(sender, identity) identity.is_authenticated = not isinstance(identity, principal.AnonymousIdentity) if identity.is_authenticated: - person = Person(identity.id, fault_in_via_ldap=False) - identity.person = person + user = person.Person(identity.id, fault_in_via_ldap=False) + identity.person = user identity.provides.add(principal.RoleNeed('authenticated')) else: identity.person = None @@ -159,6 +199,7 @@ def error_handler(error): @app.errorhandler(401) @app.errorhandler(403) +@app.errorhandler(principal.PermissionDenied) def forbidden_handler(error): return flask.render_template('forbidden.html'), 403 Added: labs/panopticon/pan-site/src/asf/panopticon/api/__init__.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/api/__init__.py?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/api/__init__.py (added) +++ labs/panopticon/pan-site/src/asf/panopticon/api/__init__.py Sat Aug 9 21:48:11 2014 @@ -0,0 +1,53 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +import logging + +import flask +from flask.ext import principal + +from asf import person + + +api = flask.Blueprint('api', __name__, template_folder='templates') + +log = logging.getLogger(__name__) + +authenticated_permission = principal.Permission(principal.RoleNeed('authenticated')) + +@api.route('/users/<username>') +@authenticated_permission.require() +def user_info(username): + try: + user = person.Person(username) + except person.PersonError: + return flask.make_response(flask.Response('No Such User %s' % username, status=404)) + + return flask.jsonify({ + 'username': user.username, + 'fullname': user.fullname, + 'email': user.email, + 'email_string': user.email_string, + 'picture_url': user.picture_url, + }) + +@api.errorhandler(401) +@api.errorhandler(403) +@api.errorhandler(principal.PermissionDenied) +def forbidden_handler(error): + return flask.render_template('api_forbidden.html', error=error), 403 Added: labs/panopticon/pan-site/src/asf/panopticon/api/templates/api_forbidden.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/api/templates/api_forbidden.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/api/templates/api_forbidden.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/api/templates/api_forbidden.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,27 @@ +{% extends "layout.html" %} + + +{% block content %} + {{ super() }} + + <section class="container"> + <div class="row"> + <div class="col-md-12"> + {% if not g.identity.is_authenticated %} + <div class="alert alert-block alert-error"> + <p><strong>You do not have permission to access this page {{ g.identity }}</strong></p> + {% if g.login_allowed %} + <p>You can <a href="{{ url_for('logout') }}">sign out</a> to log in as a different user.</p> + {% endif %} + </div> + {% elif not g.login_allowed %} + <div class="alert alert-block alert-error"> + <p><strong>Login disabled over insecure connection</strong></p> + + <p>For security reasons, login is only enabled over HTTPS.</p> + </div> + {% endif %} + </div> + </div> + </section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/foundation/__init__.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/foundation/__init__.py?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/foundation/__init__.py (added) +++ labs/panopticon/pan-site/src/asf/panopticon/foundation/__init__.py Sat Aug 9 21:48:11 2014 @@ -0,0 +1,33 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +import logging + +import flask +from flask.ext import MenuManager as menu + + +foundation = flask.Blueprint('foundation', __name__, template_folder='templates') + +log = logging.getLogger(__name__) + + +@foundation.route('/') +@menu.register_menu(foundation, '#foundation', 'Foundation', order=3) +def render_foundation(): + return flask.render_template('foundation.html') Added: labs/panopticon/pan-site/src/asf/panopticon/foundation/templates/foundation.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/foundation/templates/foundation.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/foundation/templates/foundation.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/foundation/templates/foundation.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Foundation</h1> + + <p>ASF foundation</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/infrastructure/__init__.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/infrastructure/__init__.py?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/infrastructure/__init__.py (added) +++ labs/panopticon/pan-site/src/asf/panopticon/infrastructure/__init__.py Sat Aug 9 21:48:11 2014 @@ -0,0 +1,36 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +import logging + +import flask +from flask.ext import principal +from flask.ext import MenuManager as menu + + +infrastructure = flask.Blueprint('infrastructure', __name__, template_folder='templates') + +log = logging.getLogger(__name__) + +authenticated_permission = principal.Permission(principal.RoleNeed('authenticated')) + + +@infrastructure.route('/') +@menu.register_menu(infrastructure, '#infrastructure', 'Infrastructure', order=4) +def render_infrastructure(): + return flask.render_template('infrastructure.html') Added: labs/panopticon/pan-site/src/asf/panopticon/infrastructure/templates/infrastructure.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/infrastructure/templates/infrastructure.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/infrastructure/templates/infrastructure.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/infrastructure/templates/infrastructure.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Infrastructure</h1> + + <p>ASF Infrastructure</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/podlings/__init__.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/podlings/__init__.py?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/podlings/__init__.py (added) +++ labs/panopticon/pan-site/src/asf/panopticon/podlings/__init__.py Sat Aug 9 21:48:11 2014 @@ -0,0 +1,62 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +import logging +import sys + +import flask +from flask.ext import principal +from flask.ext import MenuManager as menu + + +podlings = flask.Blueprint('podlings', __name__, template_folder='templates') + +log = logging.getLogger(__name__) + +authenticated_permission = principal.Permission(principal.RoleNeed('authenticated')) + + +def podling_membership(): + memberships = [] + memberships.append(menu.MenuEntry('#podlings#mrql', 'mrql', values={'podling': 'mrql'}, order=1)) + memberships.append(menu.MenuEntry('#podlings#yoko', 'yoko', values={'podling': 'yoko'}, order=2)) + return memberships + + +@podlings.route('/<string:podling>') +@menu.register_menu(podlings, '#podlings', 'Podlings', + order=2, + generated_fn=podling_membership, + endpoint_fn=lambda: {'podling': 'dashboard', 'a': 'b'}) +def render_podlings(podling): + return flask.render_template('podling.html', podling=podling) + + +@podlings.route('/setup') +@menu.register_menu(podlings, '#podlings#setup', 'setup', + order=sys.maxint, hidden_fn=lambda: not flask.g.identity.is_authenticated) +@authenticated_permission.require() +def render_podlings_setup(): + return flask.render_template('podlings_setup.html') + + +@podlings.route('/') +@podlings.route('/dashboard') +@menu.register_menu(podlings, '#podlings#dashboard', 'dashboard', order=sys.maxint - 1) +def render_podlings_dashboard(): + return flask.render_template('podlings_dashboard.html') Added: labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podling.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podling.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podling.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podling.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Podling</h1> + + <p>ASF podling</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Podlings</h1> + + <p>ASF podlings</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_dashboard.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_dashboard.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_dashboard.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_dashboard.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Podlings DASHBOARD</h1> + + <p>ASF podlings</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_setup.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_setup.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_setup.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/podlings/templates/podlings_setup.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Podlings SETUP</h1> + + <p>ASF podlings</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/projects/__init__.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/projects/__init__.py?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/projects/__init__.py (added) +++ labs/panopticon/pan-site/src/asf/panopticon/projects/__init__.py Sat Aug 9 21:48:11 2014 @@ -0,0 +1,66 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +import logging +import sys + +import flask +from flask.ext import principal +from flask.ext import MenuManager as menu + + +projects = flask.Blueprint('projects', __name__, template_folder='templates') + +log = logging.getLogger(__name__) + +authenticated_permission = principal.Permission(principal.RoleNeed('authenticated')) + + +def project_membership(): + memberships = [] + for order, role in enumerate(sorted(flask.g.identity.provides, key=lambda role: role.value)): + if role.value == 'authenticated': + continue + memberships.append(menu.MenuEntry('#projects#%s' % role.value, role.value, + values={'project': role.value}, + order=order)) + return memberships + + +@projects.route('/<string:project>') +@menu.register_menu(projects, '#projects', 'Projects', + order=1, + generated_fn=project_membership, + endpoint_fn=lambda: {'project': 'dashboard', 'a': 'b'}) +def render_projects(project): + return flask.render_template('project.html', project=project) + + +@projects.route('/setup') +@menu.register_menu(projects, '#projects#setup', 'setup', + order=sys.maxint, hidden_fn=lambda: not flask.g.identity.is_authenticated) +@authenticated_permission.require() +def render_projects_setup(): + return flask.render_template('projects_setup.html') + + +@projects.route('/') +@projects.route('/dashboard') +@menu.register_menu(projects, '#projects#dashboard', 'dashboard', order=sys.maxint - 1) +def render_projects_dashboard(): + return flask.render_template('projects_dashboard.html') Added: labs/panopticon/pan-site/src/asf/panopticon/projects/templates/project.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/projects/templates/project.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/projects/templates/project.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/projects/templates/project.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Project</h1> + + <p>ASF project</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_dashboard.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_dashboard.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_dashboard.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_dashboard.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Projects DASHBOARD</h1> + + <p>ASF Projects</p> + </div> + </div> +</section> +{% endblock %} Added: labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_setup.html URL: http://svn.apache.org/viewvc/labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_setup.html?rev=1617020&view=auto ============================================================================== --- labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_setup.html (added) +++ labs/panopticon/pan-site/src/asf/panopticon/projects/templates/projects_setup.html Sat Aug 9 21:48:11 2014 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block content %} +{{ super() }} + +<section> + <div class="container"> + <div class="row"> + <h1>Projects SETUP</h1> + + <p>ASF Projects</p> + </div> + </div> +</section> +{% endblock %} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@labs.apache.org For additional commands, e-mail: commits-h...@labs.apache.org