├── account ├── __init__.py ├── management │ ├── __init__.py │ └── commands │ │ ├── __init__.py │ │ └── expunge_deleted.py ├── templatetags │ ├── __init__.py │ └── account_tags.py ├── tests │ ├── __init__.py │ └── test_views.py ├── callbacks.py ├── context_processors.py ├── fields.py ├── admin.py ├── signals.py ├── decorators.py ├── mixins.py ├── auth_backends.py ├── urls.py ├── managers.py ├── conf.py ├── middleware.py └── utils.py ├── pinax_utils ├── __init__.py └── context_processors.py ├── .dockerignore ├── valuenetwork ├── api │ ├── __init__.py │ ├── models.py │ ├── tests.py │ └── urls.py ├── board │ ├── __init__.py │ ├── models.py │ ├── tests.py │ └── urls.py ├── equipment │ ├── __init__.py │ ├── models.py │ ├── tests.py │ └── urls.py ├── valueaccounting │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── templatetags │ │ ├── __init__.py │ │ └── footer_tag.py │ ├── templates │ │ └── notification │ │ │ ├── valnet_new_todo │ │ │ ├── short.txt │ │ │ └── full.txt │ │ │ ├── valnet_new_task │ │ │ ├── short.txt │ │ │ └── full.txt │ │ │ ├── valnet_deleted_todo │ │ │ ├── short.txt │ │ │ └── full.txt │ │ │ ├── valnet_join_task │ │ │ ├── short.txt │ │ │ └── full.txt │ │ │ ├── valnet_help_wanted │ │ │ ├── short.txt │ │ │ └── full.txt │ │ │ ├── valnet_payout_request │ │ │ ├── short.txt │ │ │ └── full.txt │ │ │ └── valnet_distribution │ │ │ ├── short.txt │ │ │ └── full.txt │ ├── tests │ │ ├── __init__.py │ │ ├── test_recipes.py │ │ └── test_plan_rand.py │ ├── actions.py │ └── management.py ├── templates │ ├── valueaccounting │ │ ├── lots.html │ │ ├── no_permission.html │ │ ├── _facet_filter.html │ │ ├── sessions.html │ │ ├── feature_delete_confirmation.html │ │ ├── cleanup_unvalued_resources.html │ │ ├── cleanup_work_resourcetypes.html │ │ ├── cleanup_unsourced_resources.html │ │ ├── _resource_type.html │ │ ├── project_stats.html │ │ ├── cleanup.html │ │ ├── process_type_delete_confirmation.html │ │ ├── explore.html │ │ ├── network.html │ │ ├── cleanup_resources.html │ │ ├── cleanup_resourcetypes.html │ │ ├── resource_type_delete_confirmation.html │ │ ├── bucket_filter_header.html │ │ ├── project_roles.html │ │ ├── misc.html │ │ ├── labnotes.html │ │ ├── todo_history.html │ │ ├── open_todos.html │ │ ├── order_delete_confirmation.html │ │ ├── change_order.html │ │ ├── change_event.html │ │ ├── plan_from_rt.html │ │ ├── accounting.html │ │ ├── agent_stats.html │ │ ├── finished_processes.html │ │ ├── project_wip.html │ │ ├── all_contributions.html │ │ ├── plan_from_rt_recipe.html │ │ ├── create_distribution.html │ │ ├── closed_work_orders.html │ │ ├── labnotes_history.html │ │ ├── log_time.html │ │ ├── cleanup_processes.html │ │ ├── cleanup_old_processes.html │ │ ├── resource_type_list.html │ │ ├── _network_diagram.html │ │ ├── create_exchange.html │ │ └── processes_graph.html │ ├── notification │ │ ├── full.html │ │ ├── short.txt │ │ ├── full.txt │ │ ├── notice.html │ │ ├── base.html │ │ ├── email_subject.txt │ │ ├── email_body.txt │ │ └── notice_settings.html │ ├── _footer.html │ ├── 404.html │ ├── 500.html │ ├── _projects_panel.html │ ├── admin │ │ └── base_site.html │ ├── site_base.html │ ├── theme_bootstrap │ │ ├── subnav_base.html │ │ ├── less_base.html │ │ └── banner_base.html │ ├── account │ │ └── base.html │ ├── _needs_panel.html │ ├── _creations_panel.html │ ├── _work_panel.html │ ├── homepage.html │ ├── _account_bar.html │ └── databrowse │ │ └── base.html ├── static │ ├── img │ │ ├── navmap.png │ │ ├── process.png │ │ ├── resource.png │ │ ├── stock_next.png │ │ ├── information-icon.png │ │ ├── bullet-arrow-down-icon.png │ │ └── navmap.map │ ├── css │ │ ├── chosen-sprite.png │ │ ├── chosen-sprite@2x.png │ │ ├── fractaldom.css │ │ └── radial.css │ ├── README │ └── js │ │ ├── Curry-1.0.1.js │ │ ├── jMouseWheel-1.0.min.js │ │ └── RelatedObjectLookups.js ├── site_media │ └── media │ │ └── photos │ │ ├── lever.png │ │ ├── xbill.png │ │ ├── diagram.png │ │ ├── xbill2.png │ │ ├── REA_event.png │ │ ├── UMLdiagram.png │ │ ├── edit_xbill.png │ │ ├── rea_levels.png │ │ ├── value_network.png │ │ ├── mosquito_render.jpg │ │ ├── mosquito_render_1.jpg │ │ ├── mosquito_render_2.jpg │ │ ├── joint_type_transducer.jpg │ │ ├── lever.png.128x128_q85.png │ │ ├── Mini_Oven_installed_small.jpg │ │ ├── Mini_Oven_installed_small_1.jpg │ │ ├── Optical_Fiber_Coating_Model_2.jpg │ │ ├── mosquito_render_1.jpg.64x64_q85.jpg │ │ ├── mosquito_render_2.jpg.128x128_q85.jpg │ │ ├── mosquito_render_2.jpg.64x64_q85.jpg │ │ ├── joint_type_transducer.jpg.128x128_q85.jpg │ │ ├── joint_type_transducer.jpg.200x200_q85.jpg │ │ ├── Mini_Oven_installed_small.jpg.128x128_q85.jpg │ │ ├── Mini_Oven_installed_small_1.jpg.128x128_q85.jpg │ │ └── Optical_Fiber_Coating_Model_2.jpg.128x128_q85.jpg ├── __init__.py ├── local_settings_development.py ├── urls.py ├── wsgi.py └── local_settings_example.py ├── docs ├── images │ └── homepage.png ├── configuration │ └── etc │ │ └── apache2 │ │ └── sites-available │ │ └── valuenetwork.conf └── install.txt ├── cmd ├── run-server.sh └── create-user.sh.dist ├── Vagrantfile ├── .gitignore ├── manage.py ├── CONTRIBUTORS.txt ├── noenv_requirements.txt ├── requirements.txt ├── fixCAs.py ├── Dockerfile ├── README.md └── INSTALL.md /account/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pinax_utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /valuenetwork/api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /account/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /account/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /valuenetwork/board/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /valuenetwork/equipment/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /account/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/lots.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /account/tests/__init__.py: -------------------------------------------------------------------------------- 1 | from account.tests.test_views import * -------------------------------------------------------------------------------- /valuenetwork/api/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /valuenetwork/board/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /docs/images/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/docs/images/homepage.png -------------------------------------------------------------------------------- /valuenetwork/equipment/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /valuenetwork/templates/notification/full.html: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ notice }}{% endblocktrans %} -------------------------------------------------------------------------------- /valuenetwork/templates/notification/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ notice }}{% endblocktrans %} -------------------------------------------------------------------------------- /valuenetwork/templates/notification/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ notice }}{% endblocktrans %} 2 | -------------------------------------------------------------------------------- /valuenetwork/templates/notification/notice.html: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ notice }}{% endblocktrans %} -------------------------------------------------------------------------------- /valuenetwork/static/img/navmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/img/navmap.png -------------------------------------------------------------------------------- /valuenetwork/static/img/process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/img/process.png -------------------------------------------------------------------------------- /valuenetwork/static/img/resource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/img/resource.png -------------------------------------------------------------------------------- /valuenetwork/static/img/stock_next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/img/stock_next.png -------------------------------------------------------------------------------- /valuenetwork/static/css/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/css/chosen-sprite.png -------------------------------------------------------------------------------- /valuenetwork/templates/notification/base.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% block body_class %}notices{% endblock %} 4 | -------------------------------------------------------------------------------- /valuenetwork/templates/notification/email_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}[{{ site_name }}] {{ message }}{% endblocktrans %} -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_new_todo/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% trans "New Todo assigned to you" %} 2 | -------------------------------------------------------------------------------- /valuenetwork/static/css/chosen-sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/css/chosen-sprite@2x.png -------------------------------------------------------------------------------- /valuenetwork/static/img/information-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/img/information-icon.png -------------------------------------------------------------------------------- /valuenetwork/templates/_footer.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load footer_tag %} 3 | 4 | 7 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_new_task/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% trans "New Task that fits your skills" %} 2 | -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/lever.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/lever.png -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/xbill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/xbill.png -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_deleted_todo/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% trans "Todo assigned to you was deleted" %} 2 | -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/diagram.png -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/xbill2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/xbill2.png -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/REA_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/REA_event.png -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/UMLdiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/UMLdiagram.png -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/edit_xbill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/edit_xbill.png -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/rea_levels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/rea_levels.png -------------------------------------------------------------------------------- /valuenetwork/static/img/bullet-arrow-down-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/static/img/bullet-arrow-down-icon.png -------------------------------------------------------------------------------- /cmd/run-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cp /var/www/valuenetwork/valuenetwork/local_settings{_development,}.py 4 | cd /var/www/valuenetwork && ./manage.py runserver -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/value_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/value_network.png -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_join_task/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{{ creator }} {% trans "would like to help with this task" %} 2 | -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/mosquito_render.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/mosquito_render.jpg -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_help_wanted/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{{ creator }} {% trans "requests help that fits your skills" %} 2 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_payout_request/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% trans "You got a payout request from" %} {{ payout.from_agent }} -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/mosquito_render_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/mosquito_render_1.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/mosquito_render_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/mosquito_render_2.jpg -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_distribution/short.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% trans "You got an income distribution from" %} {{ distribution.from_agent }} -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | VAGRANTFILE_API_VERSION = "2" 2 | 3 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 4 | 5 | config.vm.box = "phusion/ubuntu-14.04-amd64" 6 | 7 | end 8 | -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/joint_type_transducer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/joint_type_transducer.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/lever.png.128x128_q85.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/lever.png.128x128_q85.png -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/Mini_Oven_installed_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/Mini_Oven_installed_small.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/Mini_Oven_installed_small_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/Mini_Oven_installed_small_1.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/Optical_Fiber_Coating_Model_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/Optical_Fiber_Coating_Model_2.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/mosquito_render_1.jpg.64x64_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/mosquito_render_1.jpg.64x64_q85.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/mosquito_render_2.jpg.128x128_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/mosquito_render_2.jpg.128x128_q85.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/mosquito_render_2.jpg.64x64_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/mosquito_render_2.jpg.64x64_q85.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/joint_type_transducer.jpg.128x128_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/joint_type_transducer.jpg.128x128_q85.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/joint_type_transducer.jpg.200x200_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/joint_type_transducer.jpg.200x200_q85.jpg -------------------------------------------------------------------------------- /account/callbacks.py: -------------------------------------------------------------------------------- 1 | 2 | def account_delete_mark(deletion): 3 | deletion.user.is_active = False 4 | deletion.user.save() 5 | 6 | 7 | def account_delete_expunge(deletion): 8 | deletion.user.delete() 9 | -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/Mini_Oven_installed_small.jpg.128x128_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/Mini_Oven_installed_small.jpg.128x128_q85.jpg -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/Mini_Oven_installed_small_1.jpg.128x128_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/Mini_Oven_installed_small_1.jpg.128x128_q85.jpg -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_deleted_todo/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ creator }} deleted a Todo that was assigned to you:{% endblocktrans %} 2 | 3 | {{ description }} 4 | 5 | -------------------------------------------------------------------------------- /valuenetwork/site_media/media/photos/Optical_Fiber_Coating_Model_2.jpg.128x128_q85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valnet/valuenetwork/HEAD/valuenetwork/site_media/media/photos/Optical_Fiber_Coating_Model_2.jpg.128x128_q85.jpg -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_new_todo/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ creator }} has assigned a Todo to you: 2 | 3 | {{ description }} 4 | 5 | You can see it here:{% endblocktrans %} 6 | http://{{ current_site }}{%url start %} 7 | -------------------------------------------------------------------------------- /cmd/create-user.sh.dist: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | EMAIL='VALUE_NETWORK_EMAIL' 4 | USER='VALUE_NETWORK_USER' 5 | PASSWORD='VALUE_NETWORK_PASSWORD' 6 | echo "from django.contrib.auth.models import User; User.objects.create_superuser('$USER', '$EMAIL', '$PASSWORD')" | python manage.py shell 7 | -------------------------------------------------------------------------------- /valuenetwork/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% block title %}Page not found{% endblock %} 4 | 5 | {% block body_base %} 6 | 7 |

Page not found

8 | 9 |

We're sorry, but the requested page could not be found.

10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | local_settings.py 3 | *.sqlite 4 | *.py~ 5 | *.*~ 6 | *.html~ 7 | *~ 8 | *.swp 9 | *.swo 10 | *.log 11 | .vagrant 12 | bin/ 13 | cmd/create-user.sh 14 | include/ 15 | lib/ 16 | media/logos/*.jpg 17 | media/avatars/*.jpg 18 | media/logos/*.png 19 | media/avatars/*.png 20 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os, sys 3 | 4 | if __name__ == "__main__": 5 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "valuenetwork.settings") 6 | 7 | from django.core.management import execute_from_command_line 8 | 9 | execute_from_command_line(sys.argv) 10 | -------------------------------------------------------------------------------- /valuenetwork/static/README: -------------------------------------------------------------------------------- 1 | This directory is used to store static assets for your project. User media files 2 | (FileFields/ImageFields) are not stored here. 3 | 4 | The convention for this directory is: 5 | 6 | * css/ — stores CSS files 7 | * js/ — stores Javascript files 8 | * img/ — stores image files 9 | -------------------------------------------------------------------------------- /account/context_processors.py: -------------------------------------------------------------------------------- 1 | from account.conf import settings 2 | 3 | from account.models import Account 4 | 5 | 6 | def account(request): 7 | ctx = { 8 | "account": Account.for_request(request), 9 | "ACCOUNT_OPEN_SIGNUP": settings.ACCOUNT_OPEN_SIGNUP, 10 | } 11 | return ctx 12 | -------------------------------------------------------------------------------- /CONTRIBUTORS.txt: -------------------------------------------------------------------------------- 1 | Code Contributors 2 | ================= 3 | 4 | Bob Haugen 5 | Lynn Foster 6 | Seth Horne 7 | Thierry Marianne 8 | 9 | Ideas, testing, issue and bug reporting 10 | ======================================= 11 | 12 | Tiberius Brastaviceanu 13 | Abran Khalid 14 | Francois Bergeron 15 | Jonathan Olesik 16 | -------------------------------------------------------------------------------- /valuenetwork/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | __about__ = """ 4 | In addition to what is provided by the "zero" project, this project 5 | provides thorough integration with django-user-accounts, adding 6 | comprehensive account management functionality. It is a foundation 7 | suitable for most sites that have user accounts. 8 | """ 9 | -------------------------------------------------------------------------------- /valuenetwork/templates/500.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% block title %}Server error (500){% endblock %} 4 | 5 | {% block body_base %} 6 |

Server Error (500)

7 |

There's been an error. It's been reported to the site administrators via e-mail and will be fixed. Thanks for your patience.

8 | 9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_payout_request/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}You got a payout request from {{ payout.from_agent }} 2 | 3 | {{ payout.from_agent }} requests a payout of {{ payout.quantity_formatted }}. 4 | You can see and respond to the request here:{% endblocktrans %} 5 | http://{{ current_site }}{{ payout.get_absolute_url }} -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/no_permission.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "No permission" %}{% endblock %} 6 | 7 | {% block body_base %} 8 | 9 |
10 |

{% trans "You do not have permission to access the requested page." %}

11 |
12 | 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /pinax_utils/context_processors.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | 3 | from django.contrib.sites.models import Site 4 | 5 | 6 | def settings(request): 7 | ctx = {} 8 | if Site._meta.installed: 9 | site = Site.objects.get_current() 10 | ctx.update({ 11 | "SITE_NAME": site.name, 12 | "SITE_DOMAIN": site.domain 13 | }) 14 | return ctx 15 | -------------------------------------------------------------------------------- /valuenetwork/templates/_projects_panel.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | 3 | {% if active_projects|length > 0 %} 4 | Most active projects 5 | 6 | 13 | {% endif %} 14 | -------------------------------------------------------------------------------- /valuenetwork/templates/admin/base_site.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/base.html" %} 2 | {% load i18n %} 3 | 4 | {% block title %}{{ title }} | {% trans 'Value Network admin' %}{% endblock %} 5 | 6 | {% block branding %} 7 |

{% trans 'Value Network administration' %} « back to operational section

8 | {% endblock %} 9 | 10 | {% block nav-global %}{% endblock %} 11 | -------------------------------------------------------------------------------- /valuenetwork/templates/notification/email_body.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% load url from future %}{% url "notification_notices" as notices_url %}{% blocktrans %}You have received the following notice from {{ current_site.name }}: 2 | 3 | {{ message }} 4 | 5 | To change how you receive notifications, please go to {% endblocktrans %} {{ default_http_protocol }}://{{ current_site }}{% url "notification_notice_settings" %} 6 | -------------------------------------------------------------------------------- /account/management/commands/expunge_deleted.py: -------------------------------------------------------------------------------- 1 | from django.core.management.base import BaseCommand 2 | 3 | from account.models import AccountDeletion 4 | 5 | 6 | class Command(BaseCommand): 7 | 8 | help = "Expunge accounts deleted more than 48 hours ago." 9 | 10 | def handle(self, *args, **options): 11 | count = AccountDeletion.expunge() 12 | print "%d expunged." % count 13 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_distribution/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}You got a {{ distribution.distribution_quantity_formatted }} distribution from {{ distribution.from_agent }} 2 | 3 | You can see it here:{% endblocktrans %} 4 | http://{{ current_site }}{{ distribution.to_agent.get_absolute_url }} 5 | or here: 6 | http://{{ current_site }}{{ distribution.resource.get_absolute_url }} -------------------------------------------------------------------------------- /valuenetwork/templates/site_base.html: -------------------------------------------------------------------------------- 1 | {% extends "theme_base.html" %} 2 | 3 | {% load metron_tags %} 4 | {% load i18n %} 5 | 6 | {% block extra_head_base %} 7 | {% block extra_head %}{% endblock %} 8 | {% endblock %} 9 | 10 | {% block footer %} 11 | {% include "_footer.html" %} 12 | {% endblock %} 13 | 14 | {% block extra_body_base %} 15 | {% analytics %} 16 | {% block extra_body %}{% endblock %} 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templatetags/footer_tag.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | 3 | from valuenetwork.valueaccounting.models import HomePageLayout 4 | 5 | register = template.Library() 6 | 7 | def footer(): 8 | try: 9 | layout = HomePageLayout.objects.get(id=1) 10 | footer = layout.footer 11 | except HomePageLayout.DoesNotExist: 12 | footer = "" 13 | return footer 14 | 15 | register.simple_tag(footer) -------------------------------------------------------------------------------- /noenv_requirements.txt: -------------------------------------------------------------------------------- 1 | --extra-index-url=http://dist.pinaxproject.com/dev/ 2 | --extra-index-url=http://dist.pinaxproject.com/alpha/ 3 | 4 | South 5 | django-extensions 6 | pinax-theme-bootstrap==2.0.4 7 | pinax-theme-bootstrap-account==1.0b2 8 | django-forms-bootstrap==2.0.3.post1 9 | metron==1.0 10 | webtest 11 | django-webtest 12 | django-notification 13 | toposort 14 | django-cors-headers 15 | rdflib 16 | rdflib-jsonld 17 | djangorestframework==2.4.8 -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | --extra-index-url=http://dist.pinaxproject.com/dev/ 2 | --extra-index-url=http://dist.pinaxproject.com/alpha/ 3 | 4 | Django==1.4.22 5 | South 6 | django-extensions 7 | pinax-theme-bootstrap==2.0.4 8 | pinax-theme-bootstrap-account==1.0b2 9 | django-forms-bootstrap==2.0.3.post1 10 | metron==1.0 11 | webtest 12 | django-webtest 13 | django-notification 14 | toposort 15 | django-cors-headers 16 | rdflib 17 | rdflib-jsonld 18 | djangorestframework==2.4.8 -------------------------------------------------------------------------------- /valuenetwork/api/tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | This file demonstrates writing tests using the unittest module. These will pass 3 | when you run "manage.py test". 4 | 5 | Replace this with more appropriate tests for your application. 6 | """ 7 | 8 | from django.test import TestCase 9 | 10 | 11 | class SimpleTest(TestCase): 12 | def test_basic_addition(self): 13 | """ 14 | Tests that 1 + 1 always equals 2. 15 | """ 16 | self.assertEqual(1 + 1, 2) 17 | -------------------------------------------------------------------------------- /valuenetwork/board/tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | This file demonstrates writing tests using the unittest module. These will pass 3 | when you run "manage.py test". 4 | 5 | Replace this with more appropriate tests for your application. 6 | """ 7 | 8 | from django.test import TestCase 9 | 10 | 11 | class SimpleTest(TestCase): 12 | def test_basic_addition(self): 13 | """ 14 | Tests that 1 + 1 always equals 2. 15 | """ 16 | self.assertEqual(1 + 1, 2) 17 | -------------------------------------------------------------------------------- /valuenetwork/equipment/tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | This file demonstrates writing tests using the unittest module. These will pass 3 | when you run "manage.py test". 4 | 5 | Replace this with more appropriate tests for your application. 6 | """ 7 | 8 | from django.test import TestCase 9 | 10 | 11 | class SimpleTest(TestCase): 12 | def test_basic_addition(self): 13 | """ 14 | Tests that 1 + 1 always equals 2. 15 | """ 16 | self.assertEqual(1 + 1, 2) 17 | -------------------------------------------------------------------------------- /fixCAs.py: -------------------------------------------------------------------------------- 1 | #import pdb; pdb.set_trace() 2 | import sys 3 | from valuenetwork.valueaccounting.models import * 4 | 5 | agents = EconomicAgent.objects.all() 6 | 7 | count = 0 8 | for agent in agents: 9 | agent.is_context = agent.agent_type.is_context 10 | try: 11 | agent.save() 12 | count = count + 1 13 | except: 14 | print "Unexpected error:", sys.exc_info()[0] 15 | 16 | print "count = " + str(count) 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_help_wanted/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ creator }} requests help that fits your skills: 2 | 3 | Work required: {{ resource_type }}, Estimated duration: {{ hours }} {{ unit }} 4 | Due: {{ due_date }} 5 | 6 | {{ description }} 7 | 8 | for Process: {{ process }} 9 | 10 | This message has most likely been sent to other individuals. 11 | 12 | You can see the process here:{% endblocktrans %} 13 | http://{{ current_site }}{{ process.get_absolute_url }} 14 | -------------------------------------------------------------------------------- /account/fields.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | from account.conf import settings 4 | 5 | 6 | class TimeZoneField(models.CharField): 7 | 8 | __metaclass__ = models.SubfieldBase 9 | 10 | def __init__(self, *args, **kwargs): 11 | defaults = { 12 | "max_length": 100, 13 | "default": "", 14 | "choices": settings.ACCOUNT_TIMEZONES, 15 | "blank": True, 16 | } 17 | defaults.update(kwargs) 18 | return super(TimeZoneField, self).__init__(*args, **defaults) 19 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_join_task/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ creator }} would like to join this task: 2 | 3 | Work required: {{ resource_type }}, Estimated duration: {{ hours }} {{ unit }} 4 | Due: {{ due_date }} 5 | 6 | {{ description }} 7 | 8 | for Process: {{ process }} 9 | 10 | This message has been sent to you because you are working on this task or have assigned yourself to this task. 11 | 12 | You can see the process here:{% endblocktrans %} 13 | http://{{ current_site }}{{ process.get_absolute_url }} 14 | -------------------------------------------------------------------------------- /valuenetwork/templates/theme_bootstrap/subnav_base.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block body_base %} 6 |
7 | {% include "_messages.html" %} 8 |
9 |
10 | {% block subnav %} 11 | {% endblock %} 12 |
13 |
14 | {% block body %} 15 | {% endblock %} 16 |
17 |
18 |
19 | {% endblock %} -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/tests/__init__.py: -------------------------------------------------------------------------------- 1 | from valuenetwork.valueaccounting.tests.test_facets import * 2 | from valuenetwork.valueaccounting.tests.test_explosions import * 3 | #todo: temporarily disabled 4 | #from valuenetwork.valueaccounting.tests.test_plan_rand import * 5 | #from valuenetwork.valueaccounting.tests.test_orders import * 6 | from valuenetwork.valueaccounting.tests.test_recipes import * 7 | from valuenetwork.valueaccounting.tests.test_event_saving import * 8 | from valuenetwork.valueaccounting.tests.test_stages import * 9 | from valuenetwork.valueaccounting.tests.test_value_equations import * 10 | 11 | -------------------------------------------------------------------------------- /account/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from account.models import SignupCode, AccountDeletion, Account, EmailAddress 4 | 5 | 6 | class SignupCodeAdmin(admin.ModelAdmin): 7 | list_display = ["code", "max_uses", "use_count", "expiry", "created"] 8 | search_fields = ["code", "email"] 9 | list_filter = ["created"] 10 | 11 | 12 | admin.site.register(SignupCode, SignupCodeAdmin) 13 | admin.site.register(AccountDeletion, list_display=["email", "date_requested", "date_expunged"]) 14 | admin.site.register(Account, list_display=["user",]) 15 | admin.site.register(EmailAddress, list_display=["user", "email"]) -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/templates/notification/valnet_new_task/full.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% blocktrans %}{{ creator }} posted a new task that fits your skills: 2 | 3 | Work required: {{ resource_type }}, Estimated duration: {{ hours }} {{ unit }} 4 | Due: {{ due_date }} 5 | 6 | {{ description }} 7 | 8 | for Process: {{ process }} 9 | 10 | This message has most likely been sent to other individuals. 11 | IF you want to take the task, you can, but if not others will take it. 12 | First-come-first-served. 13 | 14 | You can see the process here:{% endblocktrans %} 15 | http://{{ current_site }}{{ process.get_absolute_url }} 16 | -------------------------------------------------------------------------------- /valuenetwork/local_settings_development.py: -------------------------------------------------------------------------------- 1 | 2 | #for a development machine 3 | DEBUG = True 4 | 5 | TEMPLATE_DEBUG = DEBUG 6 | 7 | #this is nice for development 8 | DATABASES = { 9 | 'default': { 10 | 'ENGINE': 'django.db.backends.sqlite3', 11 | 'NAME': 'valuenetwork.sqlite' 12 | } 13 | } 14 | 15 | 16 | # valueaccounting settings can be overridden 17 | USE_WORK_NOW = False 18 | SUBSTITUTABLE_DEFAULT = False 19 | 20 | STATIC_URL = "/static/" 21 | 22 | #example: Greece 23 | MAP_LATITUDE = 38.2749497 24 | MAP_LONGITUDE = 23.8102717 25 | MAP_ZOOM = 6 26 | 27 | #and you can override any other settings in settings.py -------------------------------------------------------------------------------- /docs/configuration/etc/apache2/sites-available/valuenetwork.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerName valuenetwork.dev 3 | ProxyPass / http://127.0.0.1:8000/ retry=1 acquire=3000 timeout=60 Keepalive=On 4 | ProxyPassReverse / http://127.0.0.1:8000/ 5 | ProxyPassReverse / http://valuenetwork.dev/ 6 | ProxyRequests Off 7 | ProxyPreserveHost On 8 | 9 | SetEnv proxy-nokeepalive 1 10 | 11 | 12 | Order allow,deny 13 | Allow from all 14 | 15 | 16 | errorlog "/var/log/apache2/value-network.error.log" 17 | customlog "/var/log/apache2/value-network.access.log" common 18 | -------------------------------------------------------------------------------- /valuenetwork/templates/theme_bootstrap/less_base.html: -------------------------------------------------------------------------------- 1 | {% extends "theme_bootstrap/base.html" %} 2 | 3 | {% load staticfiles %} 4 | 5 | {% block style_base %} 6 | 7 | 8 | 9 | {% block extra_style %}{% endblock %} 10 | {% endblock %} 11 | 12 | {% block script_base %} 13 | 14 | {{ block.super }} 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /valuenetwork/templates/account/base.html: -------------------------------------------------------------------------------- 1 | {% extends "subnav_base.html" %} 2 | 3 | {% load url from future %} 4 | {% load i18n %} 5 | 6 | {% block body_class %}account{% endblock %} 7 | 8 | {% block subnav %} 9 | 16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /account/signals.py: -------------------------------------------------------------------------------- 1 | import django.dispatch 2 | 3 | 4 | user_signed_up = django.dispatch.Signal(providing_args=["user", "form"]) 5 | user_sign_up_attempt = django.dispatch.Signal(providing_args=["username", "email", "result"]) 6 | user_logged_in = django.dispatch.Signal(providing_args=["user", "form"]) 7 | user_login_attempt = django.dispatch.Signal(providing_args=["username", "result"]) 8 | signup_code_sent = django.dispatch.Signal(providing_args=["signup_code"]) 9 | signup_code_used = django.dispatch.Signal(providing_args=["signup_code_result"]) 10 | email_confirmed = django.dispatch.Signal(providing_args=["email_address"]) 11 | email_confirmation_sent = django.dispatch.Signal(providing_args=["confirmation"]) 12 | password_changed = django.dispatch.Signal(providing_args=["user"]) 13 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/_facet_filter.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | 3 |

{% trans "Filter the List" %}

4 |
5 | {% csrf_token %} 6 |

{% trans "All" %}

7 | {% for facet in facets %} 8 |

{{ facet.name }}

9 | {% for val in facet.values.all %} 10 |

{{ val.value }}

11 | {% endfor %} 12 | {% endfor %} 13 | 14 | 15 |
16 | -------------------------------------------------------------------------------- /valuenetwork/static/js/Curry-1.0.1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Curry - Function currying 3 | * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com 4 | * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php) 5 | * Date: 10/4/2008 6 | * 7 | * @author Ariel Flesler 8 | * @version 1.0.1 9 | */ 10 | 11 | function curry( fn ){ 12 | return function(){ 13 | var args = curry.args(arguments), 14 | master = arguments.callee, 15 | self = this; 16 | 17 | return args.length >= fn.length ? fn.apply(self,args) : function(){ 18 | return master.apply( self, args.concat(curry.args(arguments)) ); 19 | }; 20 | }; 21 | }; 22 | 23 | curry.args = function( args ){ 24 | return Array.prototype.slice.call(args); 25 | }; 26 | 27 | Function.prototype.curry = function(){ 28 | return curry(this); 29 | }; -------------------------------------------------------------------------------- /valuenetwork/static/js/jMouseWheel-1.0.min.js: -------------------------------------------------------------------------------- 1 | (function(){function s(n,i,s,o){n[t](e+i,r=="wheel"?s:function(e){!e&&(e=window.event);var t={originalEvent:e,target:e.target||e.srcElement,type:"wheel",deltaMode:e.type=="MozMousePixelScroll"?0:1,deltaX:0,delatZ:0,preventDefault:function(){e.preventDefault?e.preventDefault():e.returnValue=false}};if(r=="mousewheel"){t.deltaY=-1/40*e.wheelDelta;e.wheelDeltaX&&(t.deltaX=-1/40*e.wheelDeltaX)}else{t.deltaY=e.detail}return s(t)},o||false)}var e="",t,n,r;if(window.addEventListener){t="addEventListener"}else{t="attachEvent";e="on"}if(document.onmousewheel!==undefined){r="mousewheel"}try{WheelEvent("wheel");r="wheel"}catch(i){}if(!r){r="DOMMouseScroll"}window.addWheelListener=function(e,t,n){s(e,r,t,n);if(r=="DOMMouseScroll"){s(e,"MozMousePixelScroll",t,n)}};$.fn.mousewheel=function(e){return this.each(function(){window.addWheelListener(this,e,true)})}})(jQuery) -------------------------------------------------------------------------------- /account/decorators.py: -------------------------------------------------------------------------------- 1 | import functools 2 | 3 | from django.utils.decorators import available_attrs 4 | 5 | from account.utils import handle_redirect_to_login 6 | 7 | 8 | def login_required(func=None, redirect_field_name="next", login_url=None): 9 | """ 10 | Decorator for views that checks that the user is logged in, redirecting 11 | to the log in page if necessary. 12 | """ 13 | def decorator(view_func): 14 | @functools.wraps(view_func, assigned=available_attrs(view_func)) 15 | def _wrapped_view(request, *args, **kwargs): 16 | if request.user.is_authenticated(): 17 | return view_func(request, *args, **kwargs) 18 | return handle_redirect_to_login( 19 | request, 20 | redirect_field_name=redirect_field_name, 21 | login_url=login_url 22 | ) 23 | return _wrapped_view 24 | if func: 25 | return decorator(func) 26 | return decorator 27 | -------------------------------------------------------------------------------- /valuenetwork/static/css/fractaldom.css: -------------------------------------------------------------------------------- 1 | .fractaldom_surface { 2 | overflow: hidden; 3 | width: 100%; 4 | height: 100%; 5 | cursor: crosshair; 6 | 7 | } 8 | svg text::selection { background: none; } 9 | 10 | .underlaySVG svg { 11 | pointer-events: none; 12 | } 13 | 14 | .underlaySVG { 15 | position: fixed; 16 | -webkit-touch-callout: none; 17 | -webkit-user-select: none; 18 | -khtml-user-select: none; 19 | -moz-user-select: none; 20 | -ms-user-select: none; 21 | user-select: none; 22 | } 23 | 24 | /* TODO use a new class, applied to drawalogs */ 25 | .fractal-dialog { 26 | padding: 0 !important; 27 | } 28 | .fractal-dialog .ui-dialog-title { 29 | width: auto; 30 | } 31 | .fractal-dialog .ui-dialog-titlebar { 32 | padding: 0 !important; 33 | } 34 | div.zoomSlider { 35 | width: 50px; 36 | height: 25px; 37 | border: 1px solid black; 38 | float: left; 39 | cursor: crosshair; 40 | } 41 | .fractaldom { 42 | overflow: scroll; 43 | padding: 0 !important; 44 | } 45 | .iconized { 46 | white-space: normal !important; 47 | } 48 | -------------------------------------------------------------------------------- /account/mixins.py: -------------------------------------------------------------------------------- 1 | from account.conf import settings 2 | from account.utils import handle_redirect_to_login 3 | 4 | 5 | class LoginRequiredMixin(object): 6 | 7 | redirect_field_name = "next" 8 | login_url = None 9 | 10 | def dispatch(self, request, *args, **kwargs): 11 | self.request = request 12 | self.args = args 13 | self.kwargs = kwargs 14 | if request.user.is_authenticated(): 15 | return super(LoginRequiredMixin, self).dispatch(request, *args, **kwargs) 16 | return self.redirect_to_login() 17 | 18 | def get_login_url(self): 19 | return self.login_url or settings.ACCOUNT_LOGIN_URL 20 | 21 | def get_next_url(self): 22 | return self.request.get_full_path() 23 | 24 | def redirect_to_login(self): 25 | return handle_redirect_to_login( 26 | self.request, 27 | redirect_field_name=self.redirect_field_name, 28 | login_url=self.get_login_url(), 29 | next_url=self.get_next_url(), 30 | ) 31 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/sessions.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sessions" %}{% endblock %} 6 | 7 | {% block body_class %}sessions{% endblock %} 8 | 9 | {% block body_base %} 10 |
11 | {% include "_messages.html" %} 12 |
13 | {% trans "Sessions" %} 14 |
15 | {% csrf_token %} 16 | 17 | 18 |
19 | {% if selected_session %} 20 |

21 | Selected: {{ selected_session.pk }} {{ selected_session.user }} {{ selected_session.expire_date }} 22 |

23 | {% endif %} 24 |

Recent sessions:

25 | {% for session in sessions %} 26 |

27 | {{ session.pk }} {{ session.user }} {{ session.expire_date }} 28 |

29 | {% endfor %} 30 |
31 |
32 | {% endblock %} 33 | -------------------------------------------------------------------------------- /valuenetwork/templates/_needs_panel.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load thumbnail %} 3 | 4 | 5 | {% if layout.needs_panel_headline %} 6 | {{ layout.needs_panel_headline|safe|urlize }} 7 | {% else %} 8 | Resources we need 9 | {% endif %} 10 | 11 | 12 | {% if not layout.needs_panel_headline %} 13 |

14 | Your contributions will be eligible for income sharing. 15 |

16 | {% endif %} 17 | 18 | 34 | -------------------------------------------------------------------------------- /account/auth_backends.py: -------------------------------------------------------------------------------- 1 | from django.db.models import Q 2 | 3 | from django.contrib.auth.backends import ModelBackend 4 | from django.contrib.auth.models import User 5 | 6 | from account.models import EmailAddress 7 | 8 | 9 | class UsernameAuthenticationBackend(ModelBackend): 10 | 11 | def authenticate(self, **credentials): 12 | try: 13 | user = User.objects.get(username__iexact=credentials["username"]) 14 | except User.DoesNotExist: 15 | return None 16 | else: 17 | if user.check_password(credentials["password"]): 18 | return user 19 | 20 | 21 | class EmailAuthenticationBackend(ModelBackend): 22 | 23 | def authenticate(self, **credentials): 24 | qs = EmailAddress.objects.filter(Q(primary=True) | Q(verified=True)) 25 | try: 26 | email_address = qs.get(email__iexact=credentials["username"]) 27 | except EmailAddress.DoesNotExist: 28 | return None 29 | else: 30 | user = email_address.user 31 | if user.check_password(credentials["password"]): 32 | return user 33 | -------------------------------------------------------------------------------- /account/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, url 2 | 3 | from account.views import SignupView, LoginView, LogoutView, DeleteView 4 | from account.views import ConfirmEmailView 5 | from account.views import ChangePasswordView, PasswordResetView, PasswordResetTokenView 6 | from account.views import SettingsView 7 | 8 | 9 | urlpatterns = patterns("", 10 | url(r"^signup/$", SignupView.as_view(), name="account_signup"), 11 | url(r"^login/$", LoginView.as_view(), name="account_login"), 12 | url(r"^logout/$", LogoutView.as_view(), name="account_logout"), 13 | url(r"^confirm_email/(?P\w+)/$", ConfirmEmailView.as_view(), name="account_confirm_email"), 14 | url(r"^password/$", ChangePasswordView.as_view(), name="account_password"), 15 | url(r"^password/reset/$", PasswordResetView.as_view(), name="account_password_reset"), 16 | url(r"^password/reset/(?P[0-9A-Za-z]+)-(?P.+)/$", PasswordResetTokenView.as_view(), name="account_password_reset_token"), 17 | url(r"^settings/$", SettingsView.as_view(), name="account_settings"), 18 | url(r"^delete/$", DeleteView.as_view(), name="account_delete"), 19 | ) 20 | -------------------------------------------------------------------------------- /valuenetwork/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.conf.urls import patterns, include, url 3 | from django.conf.urls.static import static 4 | from django.contrib.staticfiles.urls import staticfiles_urlpatterns 5 | 6 | from django.views.generic.simple import direct_to_template 7 | 8 | from django.contrib import admin 9 | admin.autodiscover() 10 | 11 | #from valuenetwork.valueaccounting.models import * 12 | 13 | 14 | urlpatterns = patterns("", 15 | url(r"^$", 'valuenetwork.valueaccounting.views.home', name="home"), 16 | url(r"^accounting/", include("valuenetwork.valueaccounting.urls")), 17 | url(r"^admin/", include(admin.site.urls)), 18 | url(r"^account/", include("account.urls")), 19 | url(r"^notification/", include("notification.urls")), 20 | url(r"^equipment/", include("valuenetwork.equipment.urls")), 21 | url(r"^board/", include("valuenetwork.board.urls")), 22 | url(r"^api/", include("valuenetwork.api.urls")), 23 | #url(r'^report_builder/', include('report_builder.urls')), 24 | ) 25 | 26 | urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 27 | urlpatterns += staticfiles_urlpatterns() 28 | -------------------------------------------------------------------------------- /account/managers.py: -------------------------------------------------------------------------------- 1 | from django.db import models, IntegrityError 2 | 3 | 4 | class EmailAddressManager(models.Manager): 5 | 6 | def add_email(self, user, email, **kwargs): 7 | confirm = kwargs.pop("confirm", False) 8 | try: 9 | email_address = self.create(user=user, email=email, **kwargs) 10 | except IntegrityError: 11 | return None 12 | else: 13 | if confirm and not email_address.verified: 14 | email_address.send_confirmation() 15 | return email_address 16 | 17 | def get_primary(self, user): 18 | try: 19 | return self.get(user=user, primary=True) 20 | except self.model.DoesNotExist: 21 | return None 22 | 23 | def get_users_for(self, email): 24 | # this is a list rather than a generator because we probably want to 25 | # do a len() on it right away 26 | return [address.user for address in self.filter(verified=True, email=email)] 27 | 28 | 29 | class EmailConfirmationManager(models.Manager): 30 | 31 | def delete_expired_confirmations(self): 32 | for confirmation in self.all(): 33 | if confirmation.key_expired(): 34 | confirmation.delete() 35 | -------------------------------------------------------------------------------- /valuenetwork/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for valuenetwork project. 3 | 4 | This module contains the WSGI application used by Django's development server 5 | and any production WSGI deployments. It should expose a module-level variable 6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover 7 | this application via the ``WSGI_APPLICATION`` setting. 8 | 9 | Usually you will have the standard Django WSGI application here, but it also 10 | might make sense to replace the whole Django WSGI application with a custom one 11 | that later delegates to the Django one. For example, you could introduce WSGI 12 | middleware here, or combine a Django application with an application of another 13 | framework. 14 | 15 | """ 16 | import os 17 | 18 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "valuenetwork.settings") 19 | 20 | # This application object is used by any WSGI server configured to use this 21 | # file. This includes Django's development server, if the WSGI_APPLICATION 22 | # setting points here. 23 | from django.core.wsgi import get_wsgi_application 24 | application = get_wsgi_application() 25 | 26 | # Apply WSGI middleware here. 27 | # from helloworld.wsgi import HelloWorldApplication 28 | # application = HelloWorldApplication(application) -------------------------------------------------------------------------------- /valuenetwork/templates/_creations_panel.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load thumbnail %} 3 | 4 | 5 | {% if layout.creations_panel_headline %} 6 | {{ layout.creations_panel_headline|safe|urlize }} 7 | {% else %} 8 | Value being created 9 | {% endif %} 10 | 11 | 12 | {% if not layout.creations_panel_headline %} 13 |

14 | Our designs are open source. We seek partners in evolving our products. 15 |

16 | {% endif %} 17 | 18 |
    19 | {% for item in value_creations %} 20 |
  • 21 | {{ item.resource_type.name }}: {% trans "created" %} {{ item.due_date }} 22 | {% if item.resource_type.photo %} 23 | 24 | {% elif item.resource_type.photo_url %} 25 | 26 | {% endif %} 27 | 32 | 33 |
  • 34 | {% endfor %} 35 |
36 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/actions.py: -------------------------------------------------------------------------------- 1 | import csv 2 | from django.core.exceptions import PermissionDenied 3 | from django.http import HttpResponse 4 | 5 | def export_as_csv(modeladmin, request, queryset): 6 | """ 7 | Generic csv export admin action. 8 | """ 9 | if not request.user.is_staff: 10 | raise PermissionDenied 11 | opts = modeladmin.model._meta 12 | response = HttpResponse(mimetype='text/csv') 13 | response['Content-Disposition'] = 'attachment; filename=%s.csv' % unicode(opts).replace('.', '_') 14 | writer = csv.writer(response) 15 | field_names = [field.name for field in opts.fields] 16 | # Write a first row with header information 17 | writer.writerow(field_names) 18 | # Write data rows 19 | for obj in queryset: 20 | #writer.writerow([str(getattr(obj, field)).encode('latin-1', 'replace') for field in field_names]) 21 | row = [] 22 | for field in field_names: 23 | x = getattr(obj, field) 24 | try: 25 | x = x.encode('latin-1', 'replace') 26 | except AttributeError: 27 | pass 28 | row.append(x) 29 | writer.writerow(row) 30 | 31 | return response 32 | export_as_csv.short_description = "Export selected objects as csv file" 33 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/feature_delete_confirmation.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Confirm deletion of " %}{{ feature }}{% endblock %} 6 | 7 | {% block body_class %}projects{% endblock %} 8 | 9 | {% block body_base %} 10 |
11 | {% include "_messages.html" %} 12 |
13 | {% trans "Are you sure you want to delete " %}{{ feature }}? 14 | 15 | {% if side_effects %} 16 |

{% trans "The following objects will be also deleted" %}:

17 | 18 |
    19 | {% for opt in feature.options.all %} 20 |
  • {{ opt }}
  • 21 | {% endfor %} 22 |
23 | 24 | {% endif %} 25 | 26 |
27 |
28 | {% csrf_token %} 29 | 30 | 31 |
32 |
33 | 34 |
35 | 36 |
37 | 38 |
39 |
40 | {% endblock %} 41 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup_unvalued_resources.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup Unvalued Resources" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 | 22 |

Used Resources without value

23 |

24 | These resources have use events but no value per unit of use. 25 |

26 |
    27 | {% for suspect in suspects %} 28 |
  • 29 | {{ suspect }} created by: {{ suspect.created_by }} created date: {{ suspect.created_date }} 30 |
  • 31 | {% endfor %} 32 |
33 | 34 |
35 |
36 | {% endblock %} 37 | {% block extra_script %} 38 | 39 | {% endblock %} 40 | 41 | {% block extra_body %} 42 | {{ block.super }} 43 | 44 | 53 | 54 | {% endblock %} 55 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup_work_resourcetypes.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup Unvalued Work ResourceTypes" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 | 22 |

Work ResourceTypes without value

23 |

24 | These resource types have work events but no value per unit. 25 |

26 |
    27 | {% for suspect in suspects %} 28 |
  • 29 | {{ suspect }} created by: {{ suspect.created_by }} created date: {{ suspect.created_date }} 30 |
  • 31 | {% endfor %} 32 |
33 | 34 |
35 |
36 | {% endblock %} 37 | {% block extra_script %} 38 | 39 | {% endblock %} 40 | 41 | {% block extra_body %} 42 | {{ block.super }} 43 | 44 | 53 | 54 | {% endblock %} 55 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup_unsourced_resources.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup Unsourced Resources" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 | 22 |

Consumed but unsourced Resources

23 |

24 | These resources have consumption events but no production, receipt or contribution events. 25 |

26 |
    27 | {% for suspect in suspects %} 28 |
  • 29 | {{ suspect }} created by: {{ suspect.created_by }} created date: {{ suspect.created_date }} 30 |
  • 31 | {% endfor %} 32 |
33 | 34 |
35 |
36 | {% endblock %} 37 | {% block extra_script %} 38 | 39 | {% endblock %} 40 | 41 | {% block extra_body %} 42 | {{ block.super }} 43 | 44 | 53 | 54 | {% endblock %} 55 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/_resource_type.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load thumbnail %} 3 | {% load bootstrap_tags %} 4 | 5 | {% if resource_type.photo %} 6 | 7 | {% elif resource_type.photo_url %} 8 | 9 | {% endif %} 10 | 11 | {% comment %}#todo pr: shd this use own or own_or_parent_recipes?{% endcomment %} 12 | {% if resource_type.producing_process_type_relationships %} 13 | {% trans "View Recipe" %} 14 | {% endif %} 15 | 16 | {% if user.is_authenticated %} 17 | {% if resource_type.is_process_output %} 18 | 19 | 20 | {% comment %}#todo pr: shd this use own or own_or_parent_recipes?{% endcomment %} 21 | {% if resource_type.producing_process_type_relationships %} 22 | {% trans "Change Recipe" %} 23 | {% else %} 24 | {% trans "Create Recipe" %} 25 | {% endif %} 26 | 27 | {% endif %} 28 | {% endif %} 29 | 30 |
{{ resource_type.facet_list }}
31 | 32 |
{{ resource_type.description|urlize|linebreaks }}
33 | 34 | 35 | -------------------------------------------------------------------------------- /valuenetwork/equipment/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, url 2 | from django.views.generic.simple import direct_to_template 3 | 4 | urlpatterns = patterns("", 5 | url(r"^log-equipment-use/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/$", 6 | 'valuenetwork.equipment.views.log_equipment_use', name="log_equipment_use"), 7 | url(r"^pay-equipment-use/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+(\.\d*)?|\.\d+)/(?P\d+)/$", 8 | 'valuenetwork.equipment.views.pay_equipment_use', name="pay_equipment_use"), 9 | url(r"^pay-equipment-use/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+)/(?P\d+(\.\d*)?|\.\d+)/(?P\d+)/(?P\d+)/(?P\d+)/$", 10 | 'valuenetwork.equipment.views.pay_equipment_use', name="pay_equipment_use"), 11 | url(r"^log-additional-inputs/(?P\d+)/(?P\d+)/$", 12 | 'valuenetwork.equipment.views.log_additional_inputs', name="log_additional_inputs"), 13 | ) -------------------------------------------------------------------------------- /account/templatetags/account_tags.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | from django.utils.html import conditional_escape 3 | 4 | from account.utils import user_display 5 | 6 | 7 | register = template.Library() 8 | 9 | 10 | class UserDisplayNode(template.Node): 11 | 12 | def __init__(self, user, as_var=None): 13 | self.user_var = template.Variable(user) 14 | self.as_var = as_var 15 | 16 | def render(self, context): 17 | user = self.user_var.resolve(context) 18 | 19 | display = user_display(user) 20 | 21 | if self.as_var: 22 | context[self.as_var] = display 23 | return u"" 24 | return conditional_escape(display) 25 | 26 | 27 | @register.tag(name="user_display") 28 | def do_user_display(parser, token): 29 | """ 30 | Example usage:: 31 | 32 | {% user_display user %} 33 | 34 | or if you need to use in a {% blocktrans %}:: 35 | 36 | {% user_display user as user_display} 37 | {% blocktrans %}{{ user_display }} has sent you a gift.{% endblocktrans %} 38 | 39 | """ 40 | bits = token.split_contents() 41 | 42 | if len(bits) == 2: 43 | user = bits[1] 44 | as_var = None 45 | elif len(bits) == 4: 46 | user = bits[1] 47 | as_var = bits[3] 48 | else: 49 | raise template.TemplateSyntaxError("'%s' takes either two or four arguments" % bits[0]) 50 | 51 | return UserDisplayNode(user, as_var) 52 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/project_stats.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | {% load i18n %} 3 | 4 | 5 | 6 | {{ page_title }} 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 |
22 | 23 |
24 | 25 | 26 | 27 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 | 31 | {% endblock %} 32 | {% block extra_script %} 33 | 34 | {% endblock %} 35 | 36 | {% block extra_body %} 37 | {{ block.super }} 38 | 39 | 48 | 49 | {% endblock %} 50 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/process_type_delete_confirmation.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Confirm deletion of " %}{{ process_type }}{% endblock %} 6 | 7 | {% block body_class %}projects{% endblock %} 8 | 9 | {% block body_base %} 10 |
11 | {% include "_messages.html" %} 12 |
13 | {% trans "Are you sure you want to delete " %}{{ process_type }}? 14 | 15 | {% if side_effects %} 16 |

{% trans "The following objects will be also deleted" %}:

17 | 18 |
    19 | {% for rt in process_type.resource_types.all %} 20 |
  • {{ rt }}
  • 21 | {% endfor %} 22 |
23 | 24 | {% endif %} 25 | 26 |
27 |
28 | {% csrf_token %} 29 | 30 | 31 | 32 |
33 | 34 |
35 | 36 |
37 | 38 |
39 | 40 |
41 |
42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/management.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db.models import signals 3 | from django.utils.translation import ugettext_noop as _ 4 | 5 | if "notification" in settings.INSTALLED_APPS: 6 | from notification import models as notification 7 | 8 | def create_notice_types(app, created_models, verbosity, **kwargs): 9 | notification.create_notice_type("valnet_join_task", _("Join Task"), _("a colleaque wants to help with this task"), default=2) 10 | notification.create_notice_type("valnet_help_wanted", _("Help Wanted"), _("a colleague requests help that fits your skills"), default=2) 11 | notification.create_notice_type("valnet_new_task", _("New Task"), _("a new task was posted that fits your skills"), default=2) 12 | notification.create_notice_type("valnet_new_todo", _("New Todo"), _("a new todo was posted that is assigned to you"), default=2) 13 | notification.create_notice_type("valnet_deleted_todo", _("Deleted Todo"), _("a todo that was assigned to you has been deleted"), default=2) 14 | notification.create_notice_type("valnet_distribution", _("New Distribution"), _("you have received a new income distribution"), default=2) 15 | notification.create_notice_type("valnet_payout_request", _("Payout Request"), _("you have received a new payout request"), default=2) 16 | print "created notice types" 17 | signals.post_syncdb.connect(create_notice_types, sender=notification) 18 | else: 19 | print "Skipping creation of NoticeTypes as notification app not found" 20 | 21 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/tests/test_recipes.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from decimal import * 3 | 4 | from django.contrib.auth.models import User 5 | from django.core.urlresolvers import reverse 6 | from django.test import Client 7 | 8 | from webtest import AppError, TestApp 9 | 10 | from django_webtest import WebTest 11 | 12 | #WebTest doc: http://webtest.pythonpaste.org/en/latest/index.html 13 | 14 | from valuenetwork.valueaccounting.models import * 15 | from valuenetwork.valueaccounting.views import * 16 | from valuenetwork.valueaccounting.utils import * 17 | from valuenetwork.valueaccounting.tests.objects_for_testing import * 18 | 19 | class RecipeTest(WebTest): 20 | 21 | """Testing recipes 22 | """ 23 | 24 | def setUp(self): 25 | 26 | recipe = Recipe() 27 | self.parent = recipe.parent 28 | self.child = recipe.child 29 | self.grandchild = recipe.grandchild 30 | 31 | 32 | def test_view_recipe(self): 33 | """Test extended_bill view 34 | """ 35 | 36 | url = ('/%s/%s/' % ('accounting/xbomfg', self.parent.id)) 37 | response = self.app.get(url , user='alice') 38 | nodes = response.context['nodes'] 39 | node0 = nodes[0] 40 | assert node0.depth == 1 41 | node1 = nodes[1] 42 | assert node1.depth == 2 43 | assert node1.xbill_object() == self.child 44 | node2 = nodes[2] 45 | assert node2.depth == 3 46 | node3 = nodes[3] 47 | assert node3.depth == 4 48 | assert node3.xbill_object() == self.grandchild 49 | 50 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | RUN apt-get update 4 | 5 | RUN apt-get -yq install git python-setuptools python-dev libc6-dev build-essential 6 | 7 | RUN easy_install pip 8 | 9 | RUN pip install --no-deps easy_thumbnails 10 | 11 | RUN pip install virtualenv 12 | 13 | RUN pip install virtualenvwrapper 14 | 15 | RUN apt-get -yq install libjpeg-dev zlib1g-dev 16 | 17 | RUN pip install Pillow 18 | 19 | RUN pip install Django==1.4.20 20 | 21 | RUN pip install South 22 | 23 | RUN pip install django_debug_toolbar==1.3.2 24 | 25 | RUN pip install django-extensions 26 | 27 | RUN pip install django-user-accounts==1.0b3 28 | 29 | RUN pip install django-forms-bootstrap==2.0.3.post1 30 | 31 | RUN pip install metron==1.0 32 | 33 | RUN pip install webtest 34 | 35 | RUN pip install django-webtest 36 | 37 | RUN pip install django-notification 38 | 39 | COPY . /var/www/valuenetwork 40 | 41 | WORKDIR /var/www/valuenetwork 42 | 43 | RUN pip install -r requirements.txt --trusted-host dist.pinaxproject.com 44 | 45 | RUN ./manage.py syncdb --noinput 46 | 47 | RUN ./manage.py migrate 48 | 49 | RUN ./manage.py loaddata ./fixtures/starters.json 50 | 51 | RUN ./manage.py loaddata ./fixtures/help.json 52 | 53 | RUN /bin/bash -c 'cp valuenetwork/local_settings{_development,}.py' 54 | 55 | COPY ./cmd/create-user.sh /usr/local/bin/create-user.sh 56 | 57 | RUN chmod +x /usr/local/bin/create-user.sh 58 | 59 | RUN /usr/local/bin/create-user.sh 60 | 61 | EXPOSE 8000 62 | 63 | COPY ./cmd/run-server.sh /usr/local/bin/run-server.sh 64 | 65 | RUN chmod +x /usr/local/bin/run-server.sh 66 | 67 | VOLUME /var/www/valuenetwork 68 | 69 | CMD ["/usr/local/bin/run-server.sh"] 70 | -------------------------------------------------------------------------------- /account/conf.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.utils.translation import get_language_info 3 | 4 | import pytz 5 | 6 | from appconf import AppConf 7 | 8 | from account.utils import load_path_attr 9 | 10 | 11 | class AccountAppConf(AppConf): 12 | 13 | OPEN_SIGNUP = True 14 | LOGIN_URL = "account_login" 15 | SIGNUP_REDIRECT_URL = "/" 16 | LOGIN_REDIRECT_URL = "/" 17 | LOGOUT_REDIRECT_URL = "/" 18 | PASSWORD_CHANGE_REDIRECT_URL = "account_password" 19 | PASSWORD_RESET_REDIRECT_URL = "account_login" 20 | REMEMBER_ME_EXPIRY = 60*60*24*365*10 21 | USER_DISPLAY = lambda user: user.username 22 | CREATE_ON_SAVE = True 23 | EMAIL_UNIQUE = True 24 | EMAIL_CONFIRMATION_REQUIRED = False 25 | EMAIL_CONFIRMATION_EMAIL = True 26 | EMAIL_CONFIRMATION_EXPIRE_DAYS = 3 27 | EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = "account_login" 28 | EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = None 29 | SETTINGS_REDIRECT_URL = "account_settings" 30 | NOTIFY_ON_PASSWORD_CHANGE = True 31 | DELETION_MARK_CALLBACK = "account.callbacks.account_delete_mark" 32 | DELETION_EXPUNGE_CALLBACK = "account.callbacks.account_delete_expunge" 33 | DELETION_EXPUNGE_HOURS = 48 34 | TIMEZONES = zip(pytz.all_timezones, pytz.all_timezones) 35 | LANGUAGES = [ 36 | (code, get_language_info(code).get("name_local")) 37 | for code, lang in settings.LANGUAGES 38 | ] 39 | 40 | def configure_deletion_mark_callback(self, value): 41 | return load_path_attr(value) 42 | 43 | def configure_deletion_expunge_callback(self, value): 44 | return load_path_attr(value) 45 | -------------------------------------------------------------------------------- /valuenetwork/templates/_work_panel.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load thumbnail %} 3 | 4 | 5 | {% if layout.work_panel_headline %} 6 | {{ layout.work_panel_headline|safe|urlize }} 7 | {% else %} 8 | Work to do 9 | {% endif %} 10 | 11 | 12 | {% if not layout.work_panel_headline %} 13 |

14 | Your work will be eligible for income sharing. 15 |

16 | {% endif %} 17 | 18 |
    19 | {% for item in work_to_do %} 20 |
  • 21 | {{ item.resource_type.name }} — {% trans "updated" %} {{ item.changed_date }}
    22 | {% if item.process %} 23 | {% trans "Purpose:" %} {{ item.description }} 24 |

    25 | Learn more... 26 |

    27 | 28 | {% comment %} 29 | 34 |

    35 | {% trans "for process" %}: {{ item.process.name }} 36 |

    37 | {% endcomment %} 38 | {% endif %} 39 |
  • 40 | {% endfor %} 41 |
42 | -------------------------------------------------------------------------------- /valuenetwork/static/css/radial.css: -------------------------------------------------------------------------------- 1 | input, select { 2 | font-size:0.9em; 3 | } 4 | 5 | table { 6 | margin-top:-10px; 7 | margin-left:7px; 8 | } 9 | 10 | h4 { 11 | font-size:1.1em; 12 | text-decoration:none; 13 | font-weight:normal; 14 | color:#23A4FF; 15 | } 16 | 17 | 18 | #container { 19 | width: 1200px; 20 | height: 700px; 21 | margin:0 auto; 22 | position:relative; 23 | } 24 | 25 | #left-container, 26 | #right-container, 27 | #center-container { 28 | height: 700px; 29 | position:absolute; 30 | top:0; 31 | } 32 | 33 | #left-container, #right-container { 34 | color:#686c70; 35 | text-align: left; 36 | overflow: auto; 37 | background-color:#fff; 38 | background-repeat:no-repeat; 39 | border-bottom:1px solid #ddd; 40 | } 41 | 42 | #left-container { 43 | width:100px; 44 | left:0; 45 | border-left:1px solid #ddd; 46 | 47 | } 48 | 49 | #right-container { 50 | width:300px; 51 | right:0; 52 | border-right:1px solid #ddd; 53 | } 54 | 55 | #right-container h4{ 56 | text-indent:8px; 57 | } 58 | 59 | #center-container { 60 | width:800px; 61 | left:100px; 62 | background-color: #FFFFCC; 63 | color: #CC99FF; 64 | } 65 | 66 | .text { 67 | margin: 7px; 68 | } 69 | 70 | #inner-details { 71 | font-size:0.8em; 72 | list-style:none; 73 | margin:7px; 74 | } 75 | 76 | #log { 77 | position:absolute; 78 | top:10px; 79 | font-size:1.0em; 80 | font-weight:bold; 81 | color:#23A4FF; 82 | } 83 | 84 | 85 | #infovis { 86 | position:relative; 87 | width:700px; 88 | height:700px; 89 | margin:auto; 90 | overflow:hidden; 91 | } -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/explore.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Explore" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}explore{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 |
    22 |
  • Something
  • 23 |
24 | 25 | 26 |
27 |
28 | {% endblock %} 29 | {% block extra_script %} 30 | 31 | {% endblock %} 32 | 33 | {% block extra_body %} 34 | {{ block.super }} 35 | 36 | 61 | 62 | {% endblock %} 63 | -------------------------------------------------------------------------------- /valuenetwork/templates/homepage.html: -------------------------------------------------------------------------------- 1 | {% extends "banner_base.html" %} 2 | 3 | {% load staticfiles %} 4 | {% load i18n %} 5 | 6 | {% block head_title %}{% trans "Welcome" %}{% endblock %} 7 | 8 | {% block body_class %}home{% endblock %} 9 | 10 | {% block banner %} 11 | 12 | {% if layout %} 13 | {{ layout.banner|safe|urlize|linebreaks }} 14 | {% else %} 15 | {% if user.is_staff %} 16 |

Create content here using Home Page Layout in Admin.

17 | {% else %} 18 |

An administrator can create content for this page.

19 | {% endif %} 20 | {% endif %} 21 | 22 | {% endblock %} 23 | 24 | {% block extra_head %} 25 | 32 | {% endblock %} 33 | 34 | {% block extra_script %} 35 | 36 | 37 | {% endblock %} 38 | 39 | {% block extra_body %} 40 | {{ block.super }} 41 | 42 | 60 | 61 | {% endblock %} 62 | 63 | -------------------------------------------------------------------------------- /account/middleware.py: -------------------------------------------------------------------------------- 1 | from django.utils import translation, timezone 2 | from django.utils.cache import patch_vary_headers 3 | 4 | from account.models import Account 5 | 6 | 7 | class LocaleMiddleware(object): 8 | """ 9 | This is a very simple middleware that parses a request 10 | and decides what translation object to install in the current 11 | thread context depending on the user's account. This allows pages 12 | to be dynamically translated to the language the user desires 13 | (if the language is available, of course). 14 | """ 15 | 16 | def get_language_for_user(self, request): 17 | if request.user.is_authenticated(): 18 | try: 19 | account = Account.objects.get(user=request.user) 20 | return account.language 21 | except Account.DoesNotExist: 22 | pass 23 | return translation.get_language_from_request(request) 24 | 25 | def process_request(self, request): 26 | translation.activate(self.get_language_for_user(request)) 27 | request.LANGUAGE_CODE = translation.get_language() 28 | 29 | def process_response(self, request, response): 30 | patch_vary_headers(response, ("Accept-Language",)) 31 | response["Content-Language"] = translation.get_language() 32 | translation.deactivate() 33 | return response 34 | 35 | 36 | class TimezoneMiddleware(object): 37 | """ 38 | This middleware sets the timezone used to display dates in 39 | templates to the user's timezone. 40 | """ 41 | 42 | def process_request(self, request): 43 | account = getattr(request.user, "account", None) 44 | if account: 45 | timezone.activate(account.timezone) 46 | -------------------------------------------------------------------------------- /valuenetwork/local_settings_example.py: -------------------------------------------------------------------------------- 1 | """ 2 | You want a local_settings.py file in the same directory 3 | as settings.py. 4 | settings.py will import it, if it exists 5 | and local_settings will override settings 6 | for the setting with the same name. 7 | 8 | You also want your localsettings.py to be different 9 | on a development machine and a server, 10 | in ways that will be mentioned below. 11 | 12 | Note: don't use this local_settings_example.py. 13 | It is internally inconsistent to show some choices. 14 | Create your own local_settings.py file 15 | to fit your own needs. 16 | 17 | """ 18 | 19 | #for a development machine 20 | DEBUG = True 21 | #for a server 22 | DEBUG = False 23 | TEMPLATE_DEBUG = DEBUG 24 | 25 | #this is nice for development 26 | DATABASES = { 27 | 'default': { 28 | 'ENGINE': 'django.db.backends.sqlite3', 29 | 'NAME': 'valuenetwork.sqlite' 30 | } 31 | } 32 | #for a server, you want a real database 33 | DATABASES = { 34 | 'default': { 35 | 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', or 'oracle'. 36 | 'NAME': '', 37 | 'USER': '', 38 | 'PASSWORD': '', 39 | 'HOST': '', 40 | 'PORT': '', # Set to empty string for default. 41 | } 42 | } 43 | 44 | STATIC_URL = "/static/" 45 | 46 | # valueaccounting settings can be overridden 47 | USE_WORK_NOW = False 48 | SUBSTITUTABLE_DEFAULT = False 49 | 50 | #example: Greece 51 | MAP_LATITUDE = 38.2749497 52 | MAP_LONGITUDE = 23.8102717 53 | MAP_ZOOM = 6 54 | 55 | STATIC_URL = "/static/" 56 | 57 | #and you can override any other settings in settings.py -------------------------------------------------------------------------------- /valuenetwork/board/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, url 2 | from django.views.generic.simple import direct_to_template 3 | 4 | urlpatterns = patterns("", 5 | url(r'^dhen-board/(?P\d+)/$', 'valuenetwork.board.views.dhen_board', name="dhen_board"), 6 | url(r'^dhen-board/$', 'valuenetwork.board.views.dhen_board', name="dhen_board"), 7 | url(r'^add-available/(?P\d+)/$', 'valuenetwork.board.views.add_available', 8 | name="add_available"), 9 | url(r'^receive-directly/(?P\d+)/$', 'valuenetwork.board.views.receive_directly', 10 | name="receive_directly"), 11 | url(r'^transfer-resource/(?P\d+)/(?P\d+)/$', 12 | 'valuenetwork.board.views.transfer_resource', name="transfer_resource"), 13 | url(r'^purchase-resource/(?P\d+)/(?P\d+)/$', 14 | 'valuenetwork.board.views.purchase_resource', name="purchase_resource"), 15 | url(r'^combine-resources/(?P\d+)/(?P\d+)/$', 16 | 'valuenetwork.board.views.combine_resources', name="combine_resources"), 17 | url(r'^change-available/(?P\d+)/$', 'valuenetwork.board.views.change_available', name="change_available"), 18 | url(r'^undo-col2/(?P\d+)/$', 'valuenetwork.board.views.undo_col2', name="undo_col2"), 19 | url(r'^undo-col3/(?P\d+)/$', 'valuenetwork.board.views.undo_col3', name="undo_col3"), 20 | url(r'^delete-farm-commitment/(?P\d+)/$', 'valuenetwork.board.views.delete_farm_commitment', name="delete_farm_commitment"), 21 | #url(r'^delete-receipt/(?P\d+)/$', 'valuenetwork.board.views.delete_receipt', name="delete_receipt"), 22 | 23 | ) -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/network.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load thumbnail %} 5 | 6 | {% block head_title %}{% trans "Project-level Value Network" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | {% endblock %} 11 | 12 | {% block body_class %}projects{% endblock %} 13 | 14 | {% block body_base %} 15 |
16 | {% include "_messages.html" %} 17 |
18 |

{% trans "Project-level Value Network" %} 19 | {% comment %} 20 | {% if resource_type.photo %} 21 | 22 | {% elif resource_type.photo_url %} 23 | 24 | {% endif %} 25 | {% endcomment %} 26 |

27 |
28 |
29 | {% trans "or just drag stuff around..." %} 30 |
31 |
32 | {% trans "Blue oval = Project" %}
33 | {% trans "Red rectangle = Resource Type" %} 34 | {% comment %} 35 |
36 | {% trans "Green rectangle = Agent" %} 37 | {% endcomment %} 38 |
39 |
40 |
41 | 42 |
43 | 44 |
45 | 46 | 47 | {% include "valueaccounting/_network_diagram.html" %} 48 | 49 |
50 | {% endblock %} 51 | {% block extra_body %} 52 | {{ block.super }} 53 | 62 | {% endblock %} 63 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup_resources.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup Resources" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 | 22 |

Orphan Resources

23 |
    24 | {% for orphan in orphans %} 25 |
  • 26 | {{ orphan }} created by: {{ orphan.created_by }} created date: {{ orphan.created_date }} 27 |
    33 | {% csrf_token %} 34 | 35 | 36 |
    37 |
  • 38 | {% endfor %} 39 |
40 | 41 |
42 |
43 | {% endblock %} 44 | {% block extra_script %} 45 | 46 | {% endblock %} 47 | 48 | {% block extra_body %} 49 | {{ block.super }} 50 | 51 | 60 | 61 | {% endblock %} 62 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup_resourcetypes.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup Resource Types" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 | 22 |

Orphan Resource Types

23 |
    24 | {% for orphan in orphans %} 25 |
  • 26 | {{ orphan }} created by: {{ orphan.created_by }} created date: {{ orphan.created_date }} 27 |
    33 | {% csrf_token %} 34 | 35 | 36 |
    37 |
  • 38 | {% endfor %} 39 |
40 | 41 |
42 |
43 | {% endblock %} 44 | {% block extra_script %} 45 | 46 | {% endblock %} 47 | 48 | {% block extra_body %} 49 | {{ block.super }} 50 | 51 | 60 | 61 | {% endblock %} 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | valuenetwork 2 | ===================== 3 | 4 | **Note: this version of this repo is no longer being maintained.** 5 | 6 | Several forks have active users and maintainers. Some of them have additional features. Here are some notable versions that are still in use and being maintained. 7 | 8 | * Sensorica is using https://github.com/Sensorica/VerdunNRP which is a lot like the original version with a lot of bugs fixed. 9 | * Freedom Coop's fork https://github.com/FreedomCoop/valuenetwork upgraded the code to Django 1.11, and added the FairCoin crypto currency, membership application forms and fees, and a Work app with access permissions by project membership. 10 | * The [Open Cooperative Ecosystem project](https://docs.opencoopecosystem.net/) added a new UI https://github.com/opencooperativeecosystem/agent which is still in progress. 11 | * LearnDeep forked the Freedom Coop fork as well as the OCE new UI: https://github.com/LearnDeepMilwaukee 12 | 13 | 14 | **Original readme:** 15 | 16 | 17 | A prototype of Value Network Accounting, being developed in collaboration with http://www.sensorica.co/ , a pioneering value network. 18 | 19 | We mean Accounting in a large sense. We are developing something analogous to an ERP system for value networks. Might call it NRP for Network Resource Planning. 20 | 21 | [Slide deck](https://docs.google.com/presentation/d/1JEPsxJOjEMHNhvIGLXzcvovrpXqpoY75YaPHDKI0t9w/pub?start=false&loop=false&delayms=3000). 22 | 23 | Background on Value Networks: http://www.sensorica.co/value-networks 24 | 25 | The prototype used the https://github.com/pinax/pinax-project-account starter project, built on the Django framework. 26 | 27 | See /docs/install.txt for developer installation instructions or [INSTALL.md](INSTALL.md). 28 | 29 | The valueaccounting app could be split out and used in other Django projects. 30 | 31 | Roadmap moved to https://github.com/valnet/valuenetwork/wiki/Roadmap 32 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/resource_type_delete_confirmation.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Confirm deletion of " %}{{ resource_type }}{% endblock %} 6 | 7 | {% block body_class %}projects{% endblock %} 8 | 9 | {% block body_base %} 10 |
11 | {% include "_messages.html" %} 12 |
13 | {% trans "Are you sure you want to delete " %}{{ resource_type }}? 14 | 15 | {% if side_effects %} 16 |

{% trans "The following objects will be also deleted" %}:

17 | 18 |
    19 | {% for ptrt in resource_type.consuming_process_type_relationships %} 20 |
  • 21 | {% blocktrans with proc_type=ptrt.process_type %} 22 | {{ resource_type }} will be removed as an input to the Process Type {{ proc_type }} 23 | {% endblocktrans %} 24 |
  • 25 | {% endfor %} 26 | {% for pt in resource_type.producing_process_types %} 27 |
  • {% blocktrans %}The Process Type {{ pt }} for making {{ resource_type }} will also be deleted{% endblocktrans %} 28 | {% if pt.resource_types.all %} 29 | {% trans "along with all of its input and output relationships" %}:
  • 30 |
      31 | {% for rt in pt.resource_types.all %} 32 |
    • {{ rt }}
    • 33 | {% endfor %} 34 |
    35 | {% else %} 36 | 37 | {% endif %} 38 | {% endfor %} 39 |
40 | 41 | {% endif %} 42 | 43 |
44 |
45 | {% csrf_token %} 46 | 47 |
48 |
49 | 50 |
51 | 52 |
53 | 54 |
55 |
56 | {% endblock %} 57 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/bucket_filter_header.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load staticfiles %} 4 | {% load i18n %} 5 | {% load bootstrap_tags %} 6 | 7 | {% block head_title %}{% trans "Filter demo - header" %}{% endblock %} 8 | 9 | {% block extra_head %} 10 | 11 | 12 | 13 | 14 | 15 | 20 | {% endblock %} 21 | 22 | {% block body_class %}work{% endblock %} 23 | 24 | {% block body_base %} 25 |
26 | {% include "_messages.html" %} 27 |
28 | 29 | {% trans "Value Equation Bucket Filter demo - header" %} 30 | 31 | 32 |
33 | {% csrf_token %} 34 | {{ header_form|as_bootstrap }} 35 | 36 |
37 | 38 |
39 |
40 | {% endblock %} 41 | {% block extra_script %} 42 | 43 | 44 | {% endblock %} 45 | 46 | {% block extra_body %} 47 | {{ block.super }} 48 | 49 | 66 | 67 | {% endblock %} 68 | -------------------------------------------------------------------------------- /valuenetwork/templates/_account_bar.html: -------------------------------------------------------------------------------- 1 | {% load account_tags %} 2 | 46 | -------------------------------------------------------------------------------- /valuenetwork/templates/notification/notice_settings.html: -------------------------------------------------------------------------------- 1 | {% extends "notification/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load url from future %} 5 | 6 | {% block body_id %}notification-settings{% endblock %} 7 | 8 | {% block head_title %}{% trans "Notification Settings" %}{% endblock %} 9 | 10 | {% block body %} 11 |

{% trans "Notification Settings" %}

12 | 13 | {% url "account_settings" as email_url %} 14 | {% if not request.user.email %} 15 | {% blocktrans %} 16 |

17 | Note: 18 | You do not have a verified email address to which notices can be sent. Add one now. 19 |

20 | {% endblocktrans %} 21 | {% endif %} 22 | 23 |
24 | {% csrf_token %} 25 | 26 | 27 | 28 | {% for header in notice_settings.column_headers %} 29 | 32 | {% endfor %} 33 | 34 | {% for row in notice_settings.rows %} 35 | 36 | 42 | {% for cell in row.cells %} 43 | 46 | {% endfor %} 47 | 48 | {% endfor %} 49 |
{% trans "Notification Type" %} 30 | {{ header.title }} 31 |
37 | {{ row.notice_type.display }}
38 | 39 | {{ row.notice_type.description }} 40 | 41 |
44 | 45 |
50 | 51 |
52 | 53 |
54 |
55 | {% endblock %} -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/project_roles.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | {% load i18n %} 3 | 4 | 5 | 6 | {% trans "Project roles" %} 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /valuenetwork/api/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, url 2 | from django.views.generic.simple import direct_to_template 3 | from django.conf.urls import url, include 4 | 5 | from rest_framework import routers 6 | 7 | from valuenetwork.api import views 8 | 9 | router = routers.DefaultRouter() 10 | router.register(r'users', views.UserViewSet) 11 | router.register(r'people', views.PeopleViewSet, 'people') 12 | router.register(r'contexts', views.ContextViewSet, 'context') 13 | router.register(r'allagents', views.AgentViewSet, 'economicagent') 14 | router.register(r'agent-types', views.AgentTypeViewSet) 15 | router.register(r'economic-events', views.EconomicEventViewSet, 'economicevent') 16 | router.register(r'contributions', views.ContributionViewSet, 'contribution') 17 | router.register(r'event-types', views.EventTypeViewSet, 'eventtype') 18 | router.register(r'resource-types', views.EconomicResourceTypeViewSet, 'economicresourcetype') 19 | router.register(r'resources', views.EconomicResourceViewSet, 'economicresource') 20 | router.register(r'units', views.UnitViewSet) 21 | 22 | router.register(r'usercreation', views.UserCreationViewSet, 'usercreation') 23 | router.register(r'agentcreation', views.AgentCreationViewSet, 'agentcreation') 24 | router.register(r'agentuser', views.AgentUserViewSet, 'agentuser') 25 | 26 | urlpatterns = patterns("", 27 | url(r'^', include(router.urls)), 28 | url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), 29 | url(r"^agent-jsonld/$", 'valuenetwork.api.views.agent_jsonld', name="agent_jsonld"), 30 | url(r"^agent-lod/(?P\d+)/$", 'valuenetwork.api.views.agent_lod', name="agent_lod"), 31 | url(r"^agent-type-lod/(?P\w+)/$", 'valuenetwork.api.views.agent_type_lod', name="agent_type_lod"), 32 | url(r"^agent-relationship-type-lod/(?P\w+)/$", 'valuenetwork.api.views.agent_relationship_type_lod', name="agent_relationship_type_lod"), 33 | url(r"^agent-relationship-lod/(?P\d+)/$", 'valuenetwork.api.views.agent_relationship_lod', name="agent_relationship_lod"), 34 | url(r"^agent-relationship-inv-lod/(?P\d+)/$", 'valuenetwork.api.views.agent_relationship_inv_lod', name="agent_relationship_inv_lod"), 35 | url(r"^agent-jsonld-query/$", 'valuenetwork.api.views.agent_jsonld_query', name="agent_jsonld_query"), 36 | 37 | ) 38 | -------------------------------------------------------------------------------- /valuenetwork/templates/theme_bootstrap/banner_base.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load thumbnail %} 5 | 6 | {% block body_base %} 7 |
8 | {% include "_messages.html" %} 9 | 10 |
11 | {% block banner %} 12 | {% endblock %} 13 |
14 | 15 | {% if layout %} 16 |
17 |
18 | {% include "_projects_panel.html" %} 19 |
20 | {% if layout.use_work_or_html_panel %} 21 |
22 | {% block column-1 %} 23 | 24 | {% if layout.use_work_panel %} 25 | {% include "_work_panel.html" %} 26 | {% else %} 27 | {{ layout.panel_1|safe|urlize|linebreaks }} 28 | {% endif %} 29 | 30 | {% endblock %} 31 |
32 | {% endif %} 33 | {% if layout.use_needs_or_html_panel %} 34 |
35 | {% block column-2 %} 36 | 37 | {% if layout.use_needs_panel %} 38 | {% include "_needs_panel.html" %} 39 | {% else %} 40 | {{ layout.panel_2|safe|urlize|linebreaks }} 41 | {% endif %} 42 | 43 | {% endblock %} 44 |
45 | {% endif %} 46 | {% if layout.use_creations_or_html_panel %} 47 |
48 | {% block column-3 %} 49 | 50 | {% if layout.use_creations_panel %} 51 | {% include "_creations_panel.html" %} 52 | {% else %} 53 | {{ layout.panel_3|safe|urlize|linebreaks }} 54 | {% endif %} 55 | 56 | {% endblock %} 57 |
58 | {% endif %} 59 |
60 | {% endif %} 61 | 62 |
63 | {% endblock %} 64 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/misc.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Miscellaneous pages and pagelets" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 |

Miscellaneous pages

22 | 23 |

Cleanup functions

24 | 25 |

Pagelets

26 |

These pagelets display information about a context agent (e.g. a Project) without any site decorations.

27 |

They are presented for a representative context agent ({{ context_agent }}), but can be used for any context agent.

28 |

They require the context agent Page name, for example, {{ context_agent.slug }}, which can be found in Admin.

29 | 30 | {% if context_agent %} 31 |

Project schedule

32 |

Project roles

33 |

All-time project stats

34 |

Last 2 months project stats

35 | {% else %} 36 |

Pagelets require a context agent.

37 | {% endif %} 38 | 39 |

Distribution without value equation

40 |
41 | {% csrf_token %} 42 | {{ ca_form }} 43 | 44 |
45 | 46 |
47 |
48 | {% endblock %} 49 | {% block extra_script %} 50 | 51 | {% endblock %} 52 | 53 | {% block extra_body %} 54 | {{ block.super }} 55 | 56 | 65 | 66 | {% endblock %} -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/labnotes.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Work Notes for Process" %}: {{ process }}{% endblock %} 6 | 7 | {% block body_class %}work{% endblock %} 8 | 9 | {% block body_base %} 10 |
11 | {% include "_messages.html" %} 12 |
13 | 14 | {% trans "Work Notes for Process" %}: {{ process }} {% if process.started %} - {% trans "Started" %} {{ process.started }}{% endif %} 15 | 16 | 17 |

18 | {% trans "for" %}: {{ process.independent_demand }} 19 |

20 | 21 |
22 | 23 |
24 | 25 |

{% trans "Previous processes" %}

26 | {% for proc in process.previous_processes %} 27 |

{{ proc }}

28 | {% endfor %} 29 | 30 |
31 | 32 |
33 | 34 |

{% trans "Next processes" %}

35 | {% for proc in process.next_processes %} 36 |

{{ proc }}

37 | {% endfor %} 38 | 39 |
40 |
41 | 42 |

{% trans "Work Notes" %}:

43 | {% for commitment in process.work_requirements %} 44 | {% if commitment.fulfilling_events %} 45 |

46 | 47 | {% trans "From" %}: {{ commitment.from_agent }} {{ commitment.resource_type }} 48 | 49 | {% if commitment.from_agent = agent %} 50 | {% trans "Open" %} 51 | {% endif %} 52 |

53 |

54 | {{ commitment.description|urlize|linebreaks }} 55 |

56 | 57 | {% with commitment.fulfilling_events as events %} 58 | {% if events %} 59 |

{% trans "Time contributions" %}:

60 | {% for event in commitment.fulfillment_events.all %} 61 |

62 | {{ event.event_date }}: {{ event.quantity }} {{ event.unit_of_quantity }} 63 |

64 | {% endfor %} 65 | {% endif %} 66 | {% endwith %} 67 | {% endif %} 68 | {% endfor %} 69 | 70 | 71 |
72 |
73 | {% endblock %} 74 | -------------------------------------------------------------------------------- /valuenetwork/static/img/navmap.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Setup Organization 10 | Setup Resource Types and Recipes 11 | Setup Exchange Types 12 | Setup Value Equations 13 | Create Customer and Work Orders 14 | Create Customer Order 15 | Plan Work From Recipe 16 | Plan Work Without Recipe 17 | Log Incoming Exchange 18 | All Work 19 | My Work 20 | Log Outgoing Exchange 21 | Distribute Rewards Using Value Equation 22 | Log Non-Production Work 23 | Cash Accounting Report 24 | All Contributions Report 25 | Incoming Exchanges Report 26 | Outgoing Exchanges Report 27 | Distributions Report 28 | Inventory Listing 29 | 30 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/todo_history.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load thumbnail %} 5 | 6 | {% block head_title %}{% trans "Todo History" %}{% endblock %} 7 | {% block extra_head %} 8 | 9 | 41 | {% endblock %} 42 | 43 | {% block body_class %}work{% endblock %} 44 | 45 | {% block body_base %} 46 |
47 | {% include "_messages.html" %} 48 |
49 | 50 | {% trans "Todo History" %} 51 | 52 | {% if todos %} 53 |
    54 | {% for todo in todos %} 55 |
  • {% trans "Todo" %}: {% trans "Poster" %}: {{ todo.to_agent }} {% trans "Due" %}: {{ todo.due_date }}
  • 56 | {% if todo.description %} 57 |

    {{ todo.description|urlize|linebreaks }}

    58 | {% endif %} 59 | {% if todo.url %} 60 |

    {{ todo.url|urlize }}

    61 | {% endif %} 62 |
      63 | {% for event in todo.fulfilling_events %} 64 |
    • {% trans "Doer" %}: {{ event.from_agent }} {{ event.event_date }}
    • 65 | {% if event.description %} 66 |

      {{ event.description|urlize|linebreaks }}

      67 | {% endif %} 68 | {% endfor %} 69 |
    70 | {% endfor %} 71 |
72 | {% endif %} 73 | 74 | 89 | 90 |
91 |
92 | {% endblock %} 93 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/open_todos.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load thumbnail %} 5 | 6 | {% block head_title %}{% trans "Open Todos" %}{% endblock %} 7 | {% block extra_head %} 8 | 9 | 41 | {% endblock %} 42 | 43 | {% block body_class %}work{% endblock %} 44 | 45 | {% block body_base %} 46 |
47 | {% include "_messages.html" %} 48 |
49 | 50 | {% trans "Open Todos" %} 51 | 52 | {% if todos %} 53 |
    54 | {% for todo in todos %} 55 |
  • {% trans "Todo" %}: {% trans "Poster" %}: {{ todo.to_agent }}, {% trans "Doer" %}: {{ todo.from_agent }}, {% trans "Due" %}: {{ todo.due_date }}
  • 56 | {% if todo.description %} 57 |

    {{ todo.description|urlize|linebreaks }}

    58 | {% endif %} 59 | {% if todo.url %} 60 |

    {{ todo.url|urlize }}

    61 | {% endif %} 62 |
      63 | {% for event in todo.fulfilling_events %} 64 |
    • {% trans "Doer" %}: {{ event.from_agent }} {{ event.event_date }}
    • 65 | {% if event.description %} 66 |

      {{ event.description|urlize|linebreaks }}

      67 | {% endif %} 68 | {% endfor %} 69 |
    70 | {% endfor %} 71 |
72 | {% endif %} 73 | 74 | 89 | 90 |
91 |
92 | {% endblock %} 93 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/order_delete_confirmation.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load url from future %} 5 | 6 | {% block head_title %}{% trans "Confirm deletion of " %}{{ order }}{% endblock %} 7 | 8 | {% block body_class %}projects{% endblock %} 9 | 10 | {% block body_base %} 11 |
12 | {% include "_messages.html" %} 13 |
14 | 15 | {% trans "Are you sure you want to delete " %}{{ order }}?
16 | {% trans "The following processes and commitments will be deleted and the events will be orphaned" %}: 17 |
18 | 19 | {% if order.order_type == "customer" %} 20 |

{% trans "Order Items" %}:

21 |
    22 | {% for item in order.producing_commitments %} 23 |
  • {{ item.quantity }} {{ item.unit_of_quantity }} {{ item.resource_type }} {{ item.feature_label }}
  • 24 | {% empty %} 25 | None 26 | {% endfor %} 27 |
28 | {% endif %} 29 | 30 | 31 |
32 |
33 | 34 | {% for item in sked %} 35 |

36 | {{ item.class_label }}: {{ item }} 37 | {% if item.fulfilling_events %} 38 |

    39 | {% for event in item.fulfilling_events %} 40 |
  • 41 | {{ event.class_label }}: {{ event }} 42 |
  • 43 | {% endfor %} 44 |
45 | {% endif %} 46 |

47 | {% endfor %} 48 |
49 |
50 | 51 |
52 |
53 | {% csrf_token %} 54 | 55 | 56 |
57 | 58 |
59 | 60 |
61 | 62 |
63 | 64 |
65 |
66 | {% endblock %} 67 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/change_order.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load url from future %} 5 | {% load bootstrap_tags %} 6 | {% load staticfiles %} 7 | 8 | {% block head_title %}{% trans "Change Order" %}: {{ order }}{% endblock %} 9 | 10 | {% block extra_head %} 11 | 12 | 13 | 14 | 15 | 20 | 21 | {% endblock %} 22 | 23 | {% block body_class %}event{% endblock %} 24 | 25 | {% block body_base %} 26 |
27 | {% include "_messages.html" %} 28 | {% trans "Change Order" %}: {{ order }} 29 | 30 |
31 | {% csrf_token %} 32 | 33 | {{ order_form|as_bootstrap }} 34 | 35 |
36 | 37 |
38 | 39 |
40 | 41 |
42 | {% endblock %} 43 | {% block extra_script %} 44 | 45 | 46 | 47 | {% endblock %} 48 | 49 | {% block extra_body %} 50 | {{ block.super }} 51 | 52 | 86 | 87 | {% endblock %} 88 | -------------------------------------------------------------------------------- /valuenetwork/templates/databrowse/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {% block title %}{% endblock %} 5 | {% block style %} 6 | 53 | {% endblock %} 54 | {% block extrahead %}{% endblock %} 55 | 56 | 57 | 58 |
59 | {% block content %}{% endblock %} 60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/change_event.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load url from future %} 5 | {% load bootstrap_tags %} 6 | {% load staticfiles %} 7 | 8 | {% block head_title %}{% trans "Change Contribution" %}{% endblock %} 9 | 10 | {% block extra_head %} 11 | 12 | 13 | 14 | 15 | 20 | 21 | {% endblock %} 22 | 23 | {% block body_class %}event{% endblock %} 24 | 25 | {% block body_base %} 26 |
27 | {% include "_messages.html" %} 28 | {% trans "Change Contribution" %} 29 | 30 |
31 | {% csrf_token %} 32 | 33 | {{ event_form|as_bootstrap }} 34 | 35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 |
43 | {% endblock %} 44 | {% block extra_script %} 45 | 46 | 47 | 48 | {% endblock %} 49 | 50 | {% block extra_body %} 51 | {{ block.super }} 52 | 53 | 99 | 100 | {% endblock %} 101 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/plan_from_rt.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load staticfiles %} 4 | {% load i18n %} 5 | {% load bootstrap_tags %} 6 | 7 | {% block head_title %}{% trans "Production" %}{% endblock %} 8 | 9 | {% block extra_head %} 10 | 11 | 12 | 13 | 14 | 18 | {% endblock %} 19 | 20 | {% block body_class %}x{% endblock %} 21 | 22 | {% block body_base %} 23 |
24 | {% include "_messages.html" %} 25 |
26 | {% trans "Plan a Process for " %} {{ resource_type.name }} 27 |
28 | {% csrf_token %} 29 | {{ form|as_bootstrap }} 30 | 31 | 32 |
33 |
34 |
35 | {% endblock %} 36 | {% block extra_script %} 37 | 38 | 39 | 40 | 41 | {% endblock %} 42 | 43 | {% block extra_body %} 44 | {{ block.super }} 45 | 46 | 98 | 99 | {% endblock %} 100 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/accounting.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | {% load thumbnail %} 6 | 7 | {% block head_title %}{% trans "Accounting for" %}: {{ agent }}{% endblock %} 8 | 9 | {% block extra_head %} 10 | 11 | 50 | 51 | {% endblock %} 52 | 53 | {% block body_class %}x{% endblock %} 54 | 55 | {% block body_base %} 56 |
57 | {% include "_messages.html" %} 58 | 59 | 60 | {{ agent.agent_type }}: {{ agent }}     61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | {% for account in accounts %} 73 | 74 | 77 | 78 | 79 | 80 | 81 | {% endfor %} 82 | 83 |
{% trans "Type" %}{% trans "Count" %}{% trans "Quantity" %}{% trans "Example" %}
75 | {{ account.event_type.name }} 76 | {{ account.count }}{{ account.quantity }}{{ account.example }}
84 | 85 | 86 |
87 | {% endblock %} 88 | 89 | {% block extra_script %} 90 | 91 | 92 | {% endblock %} 93 | 94 | 95 | {% block extra_body %} 96 | {{ block.super }} 97 | 98 | 114 | 115 | {% endblock %} 116 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/agent_stats.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Comparative stats for " %} {{ agent.name }}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 20 | {% endblock %} 21 | 22 | {% block body_class %}work{% endblock %} 23 | 24 | {% block body_base %} 25 |
26 | {% include "_messages.html" %} 27 |
28 | 29 | {% trans "Comparative stats for " %} {{ agent.name }} 30 | 31 |
32 |

{% trans "Scores for my skills" %}:

33 | {% if scores %} 34 |
    35 | {% for skill in scores %} 36 |
  • 37 | {{ skill.resource_type.name }}: {% trans "My score" %}: {{ skill.score }}, {{ skill.comparative_scores }} 38 |
  • 39 | 40 | {% endfor %} 41 |
42 | {% else %} 43 | None 44 | {% endif %} 45 | 46 |

{% trans "Logged work hours" %}:

47 | 48 |
49 | 50 | 51 | 52 |
53 |
54 | 55 | 56 |
57 | 58 | {% endblock %} 59 | {% block extra_script %} 60 | 61 | 62 | {% endblock %} 63 | 64 | {% block extra_body %} 65 | {{ block.super }} 66 | 67 | 104 | 105 | {% endblock %} 106 | -------------------------------------------------------------------------------- /account/tests/test_views.py: -------------------------------------------------------------------------------- 1 | from django.core.urlresolvers import reverse 2 | from django.test.client import RequestFactory 3 | from django.utils import unittest 4 | 5 | from django.contrib.auth.models import AnonymousUser, User 6 | 7 | from account.views import SignupView, LoginView 8 | 9 | 10 | class SignupEnabledView(SignupView): 11 | 12 | def is_open(self): 13 | return True 14 | 15 | 16 | class SignupDisabledView(SignupView): 17 | 18 | def is_open(self): 19 | return False 20 | 21 | 22 | class LoginDisabledView(LoginView): 23 | 24 | def disabled(self): 25 | return True 26 | 27 | 28 | class SignupViewTestCase(unittest.TestCase): 29 | 30 | def setUp(self): 31 | self.factory = RequestFactory() 32 | 33 | def test_get(self): 34 | request = self.factory.get(reverse("account_signup")) 35 | request.user = AnonymousUser() 36 | response = SignupEnabledView.as_view()(request) 37 | self.assertEqual(response.status_code, 200) 38 | 39 | def test_get_disabled(self): 40 | request = self.factory.get(reverse("account_signup")) 41 | request.user = AnonymousUser() 42 | response = SignupDisabledView.as_view()(request) 43 | self.assertEqual(response.status_code, 200) 44 | self.assertEqual(response.template_name, "account/signup_closed.html") 45 | 46 | def test_post_disabled(self): 47 | request = self.factory.post(reverse("account_signup")) 48 | request.user = AnonymousUser() 49 | response = SignupDisabledView.as_view()(request) 50 | self.assertEqual(response.status_code, 200) 51 | self.assertEqual(response.template_name, "account/signup_closed.html") 52 | 53 | def test_post_successful(self): 54 | post = {"username": "user", "password": "pwd", 55 | "password_confirm": "pwd", "email": "info@example.com"} 56 | request = self.factory.post(reverse("account_signup"), post) 57 | request.user = AnonymousUser() 58 | response = SignupEnabledView.as_view()(request) 59 | self.assertEqual(response.status_code, 302) 60 | user = User.objects.get(username="user") 61 | self.asserEqual(user.email, "info@example.com") 62 | 63 | 64 | class LoginViewTestCase(unittest.TestCase): 65 | 66 | def setUp(self): 67 | self.factory = RequestFactory() 68 | 69 | def test_get(self): 70 | request = self.factory.get(reverse("account_login")) 71 | request.user = AnonymousUser() 72 | response = LoginView.as_view()(request) 73 | self.assertEqual(response.status_code, 200) 74 | self.assertEqual(response.template_name, ["account/login.html"]) 75 | 76 | def test_get_disabled(self): 77 | request = self.factory.get(reverse("account_login")) 78 | request.user = AnonymousUser() 79 | response = LoginDisabledView.as_view()(request) 80 | self.assertEqual(response.status_code, 200) 81 | 82 | def test_post_disabled(self): 83 | request = self.factory.post(reverse("account_login")) 84 | request.user = AnonymousUser() 85 | response = LoginDisabledView.as_view()(request) 86 | self.assertEqual(response.status_code, 403) 87 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/finished_processes.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Finished processes for " %} {{ project }}{% endblock %} 6 | 7 | {% block extra_head %} 8 | 22 | 23 | {% endblock %} 24 | 25 | {% block body_class %}projects{% endblock %} 26 | 27 | {% block body_base %} 28 |
29 | {% include "_messages.html" %} 30 |
31 | 32 | {% trans "Finished processes for " %} {{ project.agent_type }} {{ project }} 33 | 34 | 35 |
    36 | {% for process in processes %} 37 |
  • 38 | {{ process }} 39 |
  • 40 |
      41 | {% if process.independent_demand %} 42 |
    • {% trans "For" %} {{ process.independent_demand }}
    • 43 | {% endif %} 44 | {% if process.work_requirements %} 45 |
    • {% trans "Work Requirements" %}:
    • 46 |
        47 | {% for item in process.work_requirements %} 48 |
      • 49 | {{ item.timeline_title }} 50 | {% if not item.from_agent %} 51 | 56 | {% endif %} 57 |
      • 58 | {% endfor %} 59 |
      60 | {% endif %} 61 |
    62 | {% endfor %} 63 |
64 | 65 | 66 | 81 | 82 |
83 |
84 | {% endblock %} 85 | {% block extra_body %} 86 | {{ block.super }} 87 | 96 | {% endblock %} 97 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/project_wip.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "WIP for " %} {{ project }}{% endblock %} 6 | 7 | {% block extra_head %} 8 | 22 | 23 | {% endblock %} 24 | 25 | {% block body_class %}projects{% endblock %} 26 | 27 | {% block body_base %} 28 |
29 | {% include "_messages.html" %} 30 |
31 | 32 | {% trans "Work in Process for " %} {{ project.agent_type }} {{ project }}     33 | Finished processes    34 | Process graph diagram 35 | 36 | 37 |
    38 | {% for process in processes %} 39 |
  • 40 | {{ process }} 41 |
  • 42 |
      43 | {% if process.independent_demand %} 44 |
    • {% trans "For" %} {{ process.independent_demand }}
    • 45 | {% endif %} 46 | {% if process.work_requirements %} 47 |
    • {% trans "Work Requirements" %}:
    • 48 |
        49 | {% for item in process.work_requirements %} 50 |
      • 51 | {{ item.timeline_title }} 52 | {% if not item.from_agent %} 53 | 58 | {% endif %} 59 |
      • 60 | {% endfor %} 61 |
      62 | {% endif %} 63 |
    64 | {% endfor %} 65 |
66 | 67 | 68 | 83 | 84 |
85 |
86 | {% endblock %} 87 | {% block extra_body %} 88 | {{ block.super }} 89 | 98 | {% endblock %} 99 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/all_contributions.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "All Contributions" %}{% endblock %} 6 | 7 | {% block extra_head %} 8 | 22 | 23 | {% endblock %} 24 | 25 | {% block body_class %}projects{% endblock %} 26 | 27 | {% block body_base %} 28 |
29 | {% include "_messages.html" %} 30 |
31 | {% trans "All Contributions" %} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {% for event in events %} 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 60 | 63 | 68 | 73 | 74 | {% endfor %} 75 | 76 |
{% trans "Date" %}{% trans "Type" %}{% trans "From" %}{% trans "Project" %}{% trans "Resource Type" %}{% trans "Qty" %}{% trans "URL" %}{% trans "Description" %}{% trans "Process" %}{% trans "Deliverables" %}
{{ event.event_date }}{{ event.event_type }}{{ event.from_agent }}{{ event.context_agent }}{{ event.resource_type }}{{ event.quantity_formatted }} 56 | {% if event.url %} 57 | Open 58 | {% endif %} 59 | {% if event.description %}{{ event.description|urlize }} 61 | {% else %} {{ event.commitment.description|urlize }} {% endif %} 62 | 64 | {% if event.process %} 65 | {{ event.process.name }} 66 | {% endif %} 67 | 69 | {% for d in event.process.deliverables %} 70 | {{ d }}
71 | {% endfor %} 72 |
77 | 92 | 93 |
94 |
95 | {% endblock %} 96 | {% block extra_body %} 97 | {{ block.super }} 98 | 107 | {% endblock %} 108 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/plan_from_rt_recipe.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load staticfiles %} 4 | {% load i18n %} 5 | {% load bootstrap_tags %} 6 | 7 | {% block head_title %}{% trans "Production" %}{% endblock %} 8 | 9 | {% block extra_head %} 10 | 11 | 12 | 13 | 14 | 22 | {% endblock %} 23 | 24 | {% block body_class %}x{% endblock %} 25 | 26 | {% block body_base %} 27 |
28 | {% include "_messages.html" %} 29 |
30 | {% trans "Create a Plan from Recipe for " %} {{ resource_type.name }} 31 |
32 | {% csrf_token %} 33 | {{ date_name_form|as_bootstrap }} 34 | 35 | {% if resource_required %} 36 |
37 |

This recipe needs a starting resource

38 | {% for resource in resource_type.onhand %} 39 |

40 | 41 | {{ resource.identifier }} 42 |

43 | {% empty %} 44 |

Sorry, no starting resources exist.

45 | {% endfor %} 46 |
47 | {% endif %} 48 | {% if resource_required %} 49 | 50 | {% else %} 51 | 52 | {% endif %} 53 |
54 |
55 |
56 | {% endblock %} 57 | {% block extra_script %} 58 | 59 | 60 | 61 | 62 | {% endblock %} 63 | 64 | {% block extra_body %} 65 | {{ block.super }} 66 | 67 | 93 | 94 | {% endblock %} 95 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/create_distribution.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load staticfiles %} 4 | {% load i18n %} 5 | {% load bootstrap_tags %} 6 | 7 | {% block head_title %}{% trans "Distribution" %}{% endblock %} 8 | 9 | {% block extra_head %} 10 | 11 | 12 | 13 | 14 | 24 | {% endblock %} 25 | 26 | {% block body_base %} 27 |
28 | {% include "_messages.html" %} 29 |
30 | {% if context_agent %} 31 | {% trans "Distribution in" %} {{ context_agent }} 32 |
33 | {% csrf_token %} 34 |
35 | {{ exchange_form|as_bootstrap }} 36 |
37 | 38 |
39 |
40 | 41 |
42 | 43 | {% else %} 44 |

You need a {{ context_types }}.

45 |

46 | Read the 47 | 48 | Network Setup tutorial 49 | and create one. 50 |

51 | {% endif %} 52 |
53 | 54 | {% endblock %} 55 | {% block extra_script %} 56 | 57 | 58 | 59 | 60 | {% endblock %} 61 | 62 | {% block extra_body %} 63 | {{ block.super }} 64 | 65 | 109 | 110 | {% endblock %} 111 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ## Install Docker 4 | 5 | Follow instructions from [Docker documentation](https://docs.docker.com/installation/). 6 | 7 | ## Install Vagrant 8 | 9 | If you're a `OS X` or `Windows` user, you might want to use [vagrant](https://www.vagrantup.com/) to run a `Linux` box 10 | from where to run `Docker`. 11 | 12 | In order to do so, the `Vagrantfile` of the project root directory can be relied upon. 13 | 14 | `Vagrant` can be installed by following instructions from [Vagrant documentation](https://www.vagrantup.com/downloads.html) 15 | 16 | Run a virtual machine (ubuntu 14.04) 17 | 18 | ``` 19 | vagrant up 20 | ``` 21 | 22 | Access the virtual machine via ssh 23 | 24 | ``` 25 | vagrant ssh 26 | ``` 27 | 28 | Install a http proxy to access the Docker container from outside the vagrant box 29 | 30 | Within the box 31 | 32 | ``` 33 | sudo apt-get install apache2 34 | sudo a2enmod proxy_http 35 | cd /vagrant 36 | sudo cp docs/configuration/etc/apache2/sites-available/valuenetwork.conf /etc/apache2/sites-available 37 | sudo a2ensite valuenetwork.conf 38 | sudo service apache2 reload 39 | ``` 40 | 41 | From the host machine, figure the ip address of the guest machine before adding a new entry to your host file. 42 | 43 | ``` 44 | VAGRANT_LOG=ERROR vagrant ssh -c 'ip address | grep eth0 | grep inet' 45 | ``` 46 | 47 | ``` 48 | VAGRANT_HOST=192.168.1.44 49 | sudo /bin/bash -c 'echo "'$VAGRANT_HOST' valuenetwork.dev" >> /etc/hosts' 50 | ``` 51 | 52 | Change directory before jumping to the next steps 53 | 54 | ``` 55 | cd /vagrant 56 | ``` 57 | 58 | ## Build the application image 59 | 60 | Prepare the user creation script to be executing when building the application image 61 | by exporting your own environment variables values for user, password and email. 62 | 63 | ``` 64 | export EMAIL='admin@example.com' 65 | export PASSWORD='mrY7rZZ6ztjN90fN6hy6' 66 | export USER='valuenetwork_user' 67 | 68 | sed "s/VALUE_NETWORK_EMAIL/$EMAIL/" cmd/create-user.sh.dist > cmd/create-user.sh 69 | sed -i "s/VALUE_NETWORK_PASSWORD/$PASSWORD/" cmd/create-user.sh 70 | sed -i "s/VALUE_NETWORK_USER/$USER/" cmd/create-user.sh 71 | ``` 72 | 73 | ``` 74 | # Build image as super-user 75 | sudo docker build -t valuenetwork . 76 | ``` 77 | 78 | Please note than python dependencies are installed twice using separate `RUN` command 79 | and `requirements.txt` in order to leverage cache layers. 80 | 81 | ## Run the application container 82 | 83 | ``` 84 | cd /vagrant 85 | sudo docker run --net=host -v `pwd`:/var/www/valuenetwork -d valuenetwork 86 | ``` 87 | 88 | ## Access pages served by the web server 89 | 90 | When running the container from within a virtual machine using vagrant, 91 | the virtual network interface `eth0` of the box is relied upon to run a web server listening to port 8000. 92 | 93 | ``` 94 | # Option "--net" allows us to leverage the box virtual network interface 95 | --net=host 96 | ``` 97 | 98 | At image build time, the command which can be found in `cmd/run-server.sh` 99 | would have been copied to `/var/www/valuenetwork` (path available from within the docker container). 100 | 101 | As a result, the web server running from within the docker container, from within a virtual machine, 102 | listens to requests on port 8000 of the guest loopback address. 103 | 104 | The apache2 proxy exposes the server from the host machine. 105 | 106 | At this step, you should be able to access `http://valuenetwork.dev` in a browser installed on your host: 107 | 108 | ![Homepage](docs/images/homepage.png) 109 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/closed_work_orders.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Closed Work Orders" %}{% endblock %} 6 | 7 | {% block extra_head %} 8 | 9 | 18 | {% endblock %} 19 | 20 | {% block body_class %}demand{% endblock %} 21 | 22 | {% block body_base %} 23 |
24 | {% include "_messages.html" %} 25 |
26 | {% trans "Closed Work Orders" %} 27 |
    28 | {% for rand in rands %} 29 |
  • 30 | {{ rand }} {% trans "created by" %} {{ rand.created_by }} 31 | {% if user = rand.created_by %} 32 |
    36 | {% csrf_token %} 37 | 38 | 39 | 40 |
    41 |
    45 | {% csrf_token %} 46 | 47 | 48 |
    49 | {% else %} 50 | {% if agent %} 51 | {% if user.is_superuser %} 52 |
    56 | {% csrf_token %} 57 | 58 | 59 |
    60 | {% endif %} 61 | {% endif %} 62 | {% endif %} 63 | {% if rand.description %} 64 |

    {{ rand.description|urlize|linebreaks }}

    65 | {% endif %} 66 |
  • 67 | {% endfor %} 68 |
69 |
70 |
71 | {% endblock %} 72 | 73 | {% block extra_script %} 74 | 75 | {% endblock %} 76 | 77 | {% block extra_body %} 78 | {{ block.super }} 79 | 80 | 89 | 90 | {% endblock %} 91 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/labnotes_history.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load thumbnail %} 5 | 6 | {% block head_title %}{% trans "Work Notes History" %}{% endblock %} 7 | {% block extra_head %} 8 | 9 | 41 | {% endblock %} 42 | 43 | {% block body_class %}work{% endblock %} 44 | 45 | {% block body_base %} 46 |
47 | {% include "_messages.html" %} 48 |
49 | 50 | {% trans "Work Notes History" %} 51 | 52 | {% if processes %} 53 |
    54 | {% for process in processes %} 55 |
  • {{ process }}
  • 56 |
      57 | {% for req in process.work_requirements %} 58 | {% if req.description %} 59 |
    • {{ req.from_agent }} 60 | {% trans "Work Notes" %}: 61 | {% if agent == req.from_agent %} 62 | 63 | {% trans "Open" %} 64 | 65 | {% endif %} 66 |
      {{ req.description|urlize|linebreaks }}
      67 |
    • 68 | {% endif %} 69 | {% endfor %} 70 |
    71 | {% if process.deliverables %} 72 |
      73 | {% for resource in process.deliverables %} 74 |
    • {% trans "Deliverable" %}: 75 | {{ resource }} 76 |
    • 77 | {% if resource.photo %} 78 | 79 | {% elif resource.photo_url %} 80 | 81 | {% endif %} 82 | {% endfor %} 83 |
    84 | {% endif %} 85 | {% endfor %} 86 |
87 | {% endif %} 88 | 89 | 104 | 105 |
106 |
107 | {% endblock %} 108 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/log_time.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load i18n %} 4 | {% load url from future %} 5 | {% load bootstrap_tags %} 6 | 7 | 8 | {% block head_title %}{% trans "Log Your Time Contributions" %}{% endblock %} 9 | 10 | {% block extra_head %} 11 | 30 | 31 | {% endblock %} 32 | 33 | {% block body_class %}log{% endblock %} 34 | 35 | {% block body_base %} 36 |
37 |

{% trans "Log Time Contributions for " %} {{ member }}

38 | {% if member.id %} 39 |

{% trans "Contribution history for " %} {{ member }}

40 | {% endif %} 41 | 42 |

43 | This is just a mockup for discussion; it does not work yet. But it is intended to be an easy-to-use Timer. 44 |

45 |

46 | How it could work: when you select a Project and Type of Work and enter a Description and URL (optional) and click "Start", it will start a time contribution at the current time. Whenever you change any of that information, it will end and post one time contribution and start another. When you click Stop, it will post the last time contribution. 47 |

48 |

49 | Alternatively, you could click Start and then add Description, URL, select Project and Type of Work, etc. Then you could change those information elements until you clicked Stop or Start again. (In that case, the Start button should probably move up above Description.) 50 |

51 |

52 | We could also do a more conventional ~(not a Timer)~ interface where you enter the date and the hours. 53 |

54 |

55 | Which way do you think would be easier? Which would you like best? 56 |

57 |

58 | It could also become a popup or smartphone app. 59 |

60 | 61 |
62 | 63 |
64 | {% csrf_token %} 65 |
66 | Log Time 67 | 68 | {{ form|as_bootstrap }} 69 | 70 |
71 | 72 |
73 | 74 |
75 | 76 |
77 |
78 | 79 |
80 | Select a Project 81 |
    82 | {% for root in roots %} 83 |
  • 84 | {{ root }} 85 |
  • 86 | {% if root.sub_projects.all %} 87 |
      88 | {% for kid in root.sub_projects.all %} 89 |
    • 90 | {{ kid }} 91 |
    • 92 | {% if kid.sub_projects.all %} 93 |
        94 | {% for grandkid in kid.sub_projects.all %} 95 |
      • 96 | {{ grandkid }} 97 |
      • 98 | {% endfor %} 99 |
      100 | {% endif %} 101 | {% endfor %} 102 |
    103 | {% endif %} 104 | {% endfor %} 105 | 106 |
107 |
108 | 109 |
110 | Select a Type of Work 111 |
    112 | {% for rt in resource_types %} 113 |
  • 114 | {{ rt }} 115 |
  • 116 | {% endfor %} 117 | 118 |
119 |
120 | 121 |
122 |
123 |
124 |
125 | {% endblock %} 126 | -------------------------------------------------------------------------------- /docs/install.txt: -------------------------------------------------------------------------------- 1 | To install on Ubuntu for development: 2 | 3 | You need python 2.7+, but *not* python 3+ 4 | 5 | 1. install pip globally: 6 | http://www.pip-installer.org/en/latest/installing.html#prerequisites 7 | 8 | May need to install easy_install first: 9 | sudo apt-get install python-setuptools 10 | 11 | Then install pip: 12 | sudo easy_install pip 13 | 14 | 2. install virtualenv: 15 | http://www.virtualenv.org/en/latest/index.html 16 | 17 | sudo pip install virtualenv 18 | 19 | 3. (highly recommended but not necessary): 20 | install virtualenvwrapper: 21 | http://virtualenvwrapper.readthedocs.org/en/latest/ 22 | 23 | sudo pip install virtualenvwrapper 24 | export WORKON_HOME=~/Envs 25 | mkdir -p $WORKON_HOME 26 | source /usr/local/bin/virtualenvwrapper.sh 27 | 28 | Step 6 assumes virtualenvwrapper 29 | 30 | 4. unless you don't have it already: install git 31 | sudo apt-get install git 32 | 33 | 5. We have had problems getting Pillow, one of the requirements, 34 | to handle jpegs without installing some external libraries. 35 | 36 | It's gone from requirements.txt until we figure this out more. 37 | But you will need either Pillow or PIL, the Python Imaging Library. 38 | 39 | See 40 | http://pillow.readthedocs.org/en/latest/installation.html#simple-installation 41 | for how to install Pillow on your operating system. 42 | 43 | Note: Apostolis Xekoukoulotakis reports that on Debian, Pillow requires 44 | libjpeg-dev and python2.7-dev. 45 | 46 | Here's PIL: https://pypi.python.org/pypi/PIL/ 47 | http://askubuntu.com/questions/156484/how-do-i-install-python-imaging-library-pil 48 | 49 | 6. create a virtualenv (assuming you installed virtualenvwrapper): 50 | mkvirtualenv vn --system-site-packages 51 | workon vn 52 | cdvirtualenv 53 | 54 | 7. clone the valuenetwork repo inside the vn virtualenv. 55 | git clone https://github.com/valnet/valuenetwork.git 56 | 57 | 8. cd valuenetwork 58 | 59 | 9. pip install -r requirements.txt --trusted-host dist.pinaxproject.com 60 | 61 | Note: if you get the pip error message, no such option: --trusted-host 62 | do 63 | pip install -U pip 64 | 65 | 10. pip install --no-deps easy_thumbnails 66 | 67 | 11. create the sqlite database 68 | ./manage.py syncdb 69 | and then 70 | ./manage.py migrate 71 | 72 | We've had some problems with easy_thumbnails migration. 73 | If you do, create a local_settings.py file 74 | in the same directory as settings.py and add: 75 | 76 | SOUTH_MIGRATION_MODULES = { 77 | 'easy_thumbnails': 'easy_thumbnails.south_migrations', 78 | } 79 | 80 | 12. do this to install some starter facets and patterns: 81 | ./manage.py loaddata ./fixtures/starters.json 82 | And this to load some starter help: 83 | ./manage.py loaddata ./fixtures/help.json 84 | 85 | 13. run the tests 86 | ./manage.py test valueaccounting 87 | 88 | 14. crank up the django server 89 | ./manage.py runserver 90 | 91 | 15. point browser at http://127.0.0.1:8000/ 92 | 93 | 16. You may also want a local_settings.py file 94 | in the same directory as settings.py 95 | You can look at local_settings_example.py for ideas, 96 | but don't use it as-is. (It has two database sections. 97 | You should keep only the sqlite one.) 98 | 99 | 17. When you log in for the first time, you must 100 | create an EconomicAgent for yourself. Go into Admin, 101 | which is on the pulldown menu by your username on the upper right. 102 | Click on Economic agents, and then click on "add economic agent". 103 | When you have added as much info as you want, go to the bottom 104 | of the page, and select your username in the first User 105 | select widget. 106 | You will be the only user who will need to do this. 107 | All other Agents and Users can be created from 108 | the Organization page. 109 | 110 | 18. To be able to run scripts in shell_plus: 111 | 112 | pip install ipython 113 | 114 | 115 | -------------------------------------------------------------------------------- /account/utils.py: -------------------------------------------------------------------------------- 1 | import functools 2 | import hashlib 3 | import importlib 4 | import random 5 | import urlparse 6 | 7 | from django.core import urlresolvers 8 | from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation 9 | from django.http import HttpResponseRedirect, QueryDict 10 | 11 | from account.conf import settings 12 | 13 | 14 | def default_redirect(request, fallback_url, **kwargs): 15 | redirect_field_name = kwargs.get("redirect_field_name", "next") 16 | next = request.REQUEST.get(redirect_field_name) 17 | if not next: 18 | # try the session if available 19 | if hasattr(request, "session"): 20 | session_key_value = kwargs.get("session_key_value", "redirect_to") 21 | next = request.session.get(session_key_value) 22 | is_safe = functools.partial( 23 | ensure_safe_url, 24 | allowed_protocols=kwargs.get("allowed_protocols"), 25 | allowed_host=request.get_host() 26 | ) 27 | redirect_to = next if next and is_safe(next) else fallback_url 28 | # perform one last check to ensure the URL is safe to redirect to. if it 29 | # is not then we should bail here as it is likely developer error and 30 | # they should be notified 31 | is_safe(redirect_to, raise_on_fail=True) 32 | return redirect_to 33 | 34 | 35 | def user_display(user): 36 | return settings.ACCOUNT_USER_DISPLAY(user) 37 | 38 | 39 | def ensure_safe_url(url, allowed_protocols=None, allowed_host=None, raise_on_fail=False): 40 | if allowed_protocols is None: 41 | allowed_protocols = ["http", "https"] 42 | parsed = urlparse.urlparse(url) 43 | # perform security checks to ensure no malicious intent 44 | # (i.e., an XSS attack with a data URL) 45 | safe = True 46 | if parsed.scheme and parsed.scheme not in allowed_protocols: 47 | if raise_on_fail: 48 | raise SuspiciousOperation("Unsafe redirect to URL with protocol '%s'" % parsed.scheme) 49 | safe = False 50 | if allowed_host and parsed.netloc and parsed.netloc != allowed_host: 51 | if raise_on_fail: 52 | raise SuspiciousOperation("Unsafe redirect to URL not matching host '%s'" % allowed_host) 53 | safe = False 54 | return safe 55 | 56 | 57 | def random_token(extra=None, hash_func=hashlib.sha256): 58 | if extra is None: 59 | extra = [] 60 | bits = extra + [str(random.SystemRandom().getrandbits(512))] 61 | return hash_func("".join(bits)).hexdigest() 62 | 63 | 64 | def handle_redirect_to_login(request, **kwargs): 65 | login_url = kwargs.get("login_url") 66 | redirect_field_name = kwargs.get("redirect_field_name") 67 | next_url = kwargs.get("next_url") 68 | if login_url is None: 69 | login_url = settings.ACCOUNT_LOGIN_URL 70 | if next_url is None: 71 | next_url = request.get_full_path() 72 | try: 73 | login_url = urlresolvers.reverse(login_url) 74 | except urlresolvers.NoReverseMatch: 75 | if callable(login_url): 76 | raise 77 | if "/" not in login_url and "." not in login_url: 78 | raise 79 | url_bits = list(urlparse.urlparse(login_url)) 80 | if redirect_field_name: 81 | querystring = QueryDict(url_bits[4], mutable=True) 82 | querystring[redirect_field_name] = next_url 83 | url_bits[4] = querystring.urlencode(safe="/") 84 | return HttpResponseRedirect(urlparse.urlunparse(url_bits)) 85 | 86 | 87 | def load_path_attr(path): 88 | i = path.rfind(".") 89 | module, attr = path[:i], path[i+1:] 90 | try: 91 | mod = importlib.import_module(module) 92 | except ImportError, e: 93 | raise ImproperlyConfigured("Error importing %s: '%s'" % (module, e)) 94 | try: 95 | attr = getattr(mod, attr) 96 | except AttributeError: 97 | raise ImproperlyConfigured("Module '%s' does not define a '%s'" % (module, attr)) 98 | return attr 99 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup_processes.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup Processes" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 | 22 |

Orphan processes

23 |
    24 | {% for orphan in orphans %} 25 |
  • 26 | {{ orphan }} created by: {{ orphan.created_by }} created date: {{ orphan.created_date }} Finished: {{ orphan.finished }} 27 | {% if not orphan.finished %} 28 |
    34 | {% csrf_token %} 35 | 36 | 37 |
    38 | {% endif %} 39 | {% if orphan.is_deletable %} 40 |
    46 | {% csrf_token %} 47 | 48 | 49 |
    50 | {% endif %} 51 |
  • 52 | {% if orphan.notes %} 53 |

    {{ orphan.notes|urlize|linebreaks }}

    54 | {% endif %} 55 | {% if orphan.events.all %} 56 |
      57 | {% for event in orphan.events.all %} 58 |
    • 59 | {{ event }} 60 | {% if not event.quantity %} 61 |
      67 | {% csrf_token %} 68 | 69 | 70 |
      71 | {% endif %} 72 | 73 | {% endfor %} 74 |
    75 | {% endif %} 76 | {% endfor %} 77 |
78 | 79 |
80 |
81 | {% endblock %} 82 | {% block extra_script %} 83 | 84 | {% endblock %} 85 | 86 | {% block extra_body %} 87 | {{ block.super }} 88 | 89 | 98 | 99 | {% endblock %} 100 | -------------------------------------------------------------------------------- /valuenetwork/static/js/RelatedObjectLookups.js: -------------------------------------------------------------------------------- 1 | // cloned from django admin to trigger select change event 2 | // Handles related-objects functionality: lookup link for raw_id_fields 3 | // and Add Another links. 4 | 5 | function html_unescape(text) { 6 | // Unescape a string that was escaped using django.utils.html.escape. 7 | text = text.replace(/</g, '<'); 8 | text = text.replace(/>/g, '>'); 9 | text = text.replace(/"/g, '"'); 10 | text = text.replace(/'/g, "'"); 11 | text = text.replace(/&/g, '&'); 12 | return text; 13 | } 14 | 15 | // IE doesn't accept periods or dashes in the window name, but the element IDs 16 | // we use to generate popup window names may contain them, therefore we map them 17 | // to allowed characters in a reversible way so that we can locate the correct 18 | // element when the popup window is dismissed. 19 | function id_to_windowname(text) { 20 | text = text.replace(/\./g, '__dot__'); 21 | text = text.replace(/\-/g, '__dash__'); 22 | return text; 23 | } 24 | 25 | function windowname_to_id(text) { 26 | text = text.replace(/__dot__/g, '.'); 27 | text = text.replace(/__dash__/g, '-'); 28 | return text; 29 | } 30 | 31 | function showRelatedObjectLookupPopup(triggeringLink) { 32 | var name = triggeringLink.id.replace(/^lookup_/, ''); 33 | name = id_to_windowname(name); 34 | var href; 35 | if (triggeringLink.href.search(/\?/) >= 0) { 36 | href = triggeringLink.href + '&pop=1'; 37 | } else { 38 | href = triggeringLink.href + '?pop=1'; 39 | } 40 | var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes'); 41 | win.focus(); 42 | return false; 43 | } 44 | 45 | function dismissRelatedLookupPopup(win, chosenId) { 46 | var name = windowname_to_id(win.name); 47 | var elem = document.getElementById(name); 48 | if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) { 49 | elem.value += ',' + chosenId; 50 | } else { 51 | document.getElementById(name).value = chosenId; 52 | } 53 | win.close(); 54 | } 55 | 56 | function showAddAnotherPopup(triggeringLink) { 57 | var name = triggeringLink.id.replace(/^add_/, ''); 58 | name = id_to_windowname(name); 59 | href = triggeringLink.href 60 | if (href.indexOf('?') == -1) { 61 | href += '?_popup=1'; 62 | } else { 63 | href += '&_popup=1'; 64 | } 65 | var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes'); 66 | win.focus(); 67 | return false; 68 | } 69 | 70 | function dismissAddAnotherPopup(win, newId, newRepr) { 71 | // newId and newRepr are expected to have previously been escaped by 72 | // django.utils.html.escape. 73 | newId = html_unescape(newId); 74 | newRepr = html_unescape(newRepr); 75 | var name = windowname_to_id(win.name); 76 | var elem = document.getElementById(name); 77 | if (elem) { 78 | var elemName = elem.nodeName.toUpperCase(); 79 | if (elemName == 'SELECT') { 80 | var o = new Option(newRepr, newId); 81 | elem.options[elem.options.length] = o; 82 | o.selected = true; 83 | 84 | } else if (elemName == 'INPUT') { 85 | if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) { 86 | elem.value += ',' + newId; 87 | } else { 88 | elem.value = newId; 89 | } 90 | } 91 | if ("fireEvent" in elem) 92 | elem.fireEvent("onchange"); 93 | else 94 | { 95 | var evt = win.document.createEvent("HTMLEvents"); 96 | evt.initEvent("change", false, true); 97 | elem.dispatchEvent(evt); 98 | } 99 | } else { 100 | var toId = name + "_to"; 101 | elem = document.getElementById(toId); 102 | var o = new Option(newRepr, newId); 103 | SelectBox.add_to_cache(toId, o); 104 | SelectBox.redisplay(toId); 105 | } 106 | win.close(); 107 | } 108 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/cleanup_old_processes.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | {% load staticfiles %} 3 | {% load i18n %} 4 | {% load bootstrap_tags %} 5 | 6 | {% block head_title %}{% trans "Cleanup Old Processes" %}{% endblock %} 7 | 8 | {% block extra_head %} 9 | 10 | 13 | {% endblock %} 14 | 15 | {% block body_class %}cleanup{% endblock %} 16 | 17 | {% block body_base %} 18 |
19 | {% include "_messages.html" %} 20 |
21 | 22 | These processes are more than 30 days old and unfinished 23 | 24 |
    25 | {% for orphan in orphans %} 26 |
  • 27 | #{{ orphan.id }}: {{ orphan }} created by: {{ orphan.created_by }} created date: {{ orphan.created_date }} Finished: {{ orphan.finished }} 28 | {% if not orphan.finished %} 29 |
    35 | {% csrf_token %} 36 | 37 | 38 |
    39 | {% endif %} 40 | {% if orphan.is_deletable %} 41 |
    47 | {% csrf_token %} 48 | 49 | 50 |
    51 | {% endif %} 52 |
  • 53 | {% if orphan.notes %} 54 |

    {{ orphan.notes|urlize|linebreaks }}

    55 | {% endif %} 56 | {% if orphan.events.all %} 57 |
      58 | {% for event in orphan.events.all %} 59 |
    • 60 | {{ event }} 61 | {% if not event.quantity %} 62 |
      68 | {% csrf_token %} 69 | 70 | 71 |
      72 | {% endif %} 73 | 74 | {% endfor %} 75 |
    76 | {% endif %} 77 | {% endfor %} 78 |
79 | 80 |
81 |
82 | {% endblock %} 83 | {% block extra_script %} 84 | 85 | {% endblock %} 86 | 87 | {% block extra_body %} 88 | {{ block.super }} 89 | 90 | 99 | 100 | {% endblock %} 101 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/resource_type_list.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load staticfiles %} 4 | {% load i18n %} 5 | {% load bootstrap_tags %} 6 | 7 | 8 | {% block head_title %} 9 | {% trans "Resource Type List" %} 10 | {% if rt_list %} 11 | {{ rt_list }} 12 | {% endif %} 13 | {% endblock %} 14 | 15 | {% block extra_head %} 16 | 17 | 18 | 19 | 20 | 33 | 34 | {% endblock %} 35 | 36 | {% block body_class %}log{% endblock %} 37 | 38 | {% block body_base %} 39 |
40 | 41 | {% if rt_list %} 42 | {% trans "Change Resource Type List" %} {{ rt_list }} 43 | {% else %} 44 | {% trans "Create Resource Type List" %} 45 | {% endif %} 46 | 47 | 48 | 49 |
50 | {% csrf_token %} 51 |
52 | {{rtl_form|as_bootstrap}} 53 |
54 | 55 |
56 |
57 |
58 |
59 | 60 |
61 |
62 | 63 |
64 |
65 | 66 | 67 | 68 | 69 | {% comment %}{% endcomment %} 70 | 71 | 72 | 73 | 74 | {% for form in element_forms %} 75 | {{ form.resource_type_id }} 76 | 77 | 78 | {% comment %}{% endcomment %} 79 | 80 | 81 | {% endfor %} 82 | 83 |
{% trans "Resource Type" %}{% trans "Default Quantity" %}{% trans "Selected" %}
{{ form.resource_type_name }}{{ form.default_quantity }}{{ form.added }}
84 |
85 |
86 | 87 |
88 |
89 |
90 |
91 | 92 |
93 |
94 | 95 |
96 | 97 |
98 | {% endblock %} 99 | {% block extra_script %} 100 | 101 | 102 | 103 | {% endblock %} 104 | 105 | {% block extra_body %} 106 | {{ block.super }} 107 | 108 | 128 | 129 | {% endblock %} 130 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/_network_diagram.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 118 | 119 | -------------------------------------------------------------------------------- /valuenetwork/valueaccounting/tests/test_plan_rand.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from decimal import * 3 | 4 | from django.contrib.auth.models import User 5 | from django.core.urlresolvers import reverse 6 | from django.test import Client 7 | 8 | from webtest import AppError, TestApp 9 | 10 | from django_webtest import WebTest 11 | 12 | #WebTest doc: http://webtest.pythonpaste.org/en/latest/index.html 13 | 14 | from valuenetwork.valueaccounting.models import * 15 | from valuenetwork.valueaccounting.views import * 16 | from valuenetwork.valueaccounting.utils import * 17 | from valuenetwork.valueaccounting.tests.objects_for_testing import * 18 | 19 | class PlanRandTest(WebTest): 20 | 21 | """Testing planning R&D work 22 | """ 23 | 24 | def setUp(self): 25 | 26 | facets = Facets() 27 | self.electronic_pattern = facets.electronic_pattern 28 | self.full_pattern = facets.full_pattern 29 | electronic_domain = facets.domain.values.get(value="Electronical") 30 | source_us = facets.source.values.get(value="Us") 31 | self.project = Project(name="Test Project") 32 | self.project.save() 33 | recipe = Recipe() 34 | self.parent = recipe.parent 35 | self.child = recipe.child 36 | self.grandchild = recipe.grandchild 37 | rtfv = ResourceTypeFacetValue( 38 | resource_type=self.parent, 39 | facet_value=electronic_domain, 40 | ) 41 | rtfv.save() 42 | rtfv = ResourceTypeFacetValue( 43 | resource_type=self.parent, 44 | facet_value=source_us, 45 | ) 46 | rtfv.save() 47 | 48 | 49 | def test_process_selections(self): 50 | """Test process_selections view 51 | 52 | and subsequent dependent demand explosion 53 | 54 | """ 55 | 56 | response = self.app.get('/accounting/process-selections/1/' , user='alice') 57 | form = response.form 58 | patterns = form["pattern"].options 59 | projects = form["project"].options 60 | self.assertEqual(len(patterns), 5) 61 | self.assertEqual(len(projects), 1) 62 | form["pattern"] = unicode(self.full_pattern.id) 63 | form["project"] = unicode(self.project.id) 64 | response = form.submit("get-related") 65 | form = response.form 66 | form["produces~parent"].checked = True 67 | form["work~Work Resource Type"].checked = True 68 | form["uses~Electronic Resource Type"].checked = True 69 | form["consumes~Optical Resource Type"].checked = True 70 | form["cites~Two facets Resource Type"].checked = True 71 | #import pdb; pdb.set_trace() 72 | response = form.submit("create-process") 73 | process = self.parent.producing_commitments()[0].process 74 | incoming = process.incoming_commitments() 75 | #import pdb; pdb.set_trace() 76 | work_input = incoming.filter(event_type__relationship="work") 77 | used_input = incoming.filter(event_type__relationship="use") 78 | cited_input = incoming.filter(event_type__relationship="cite") 79 | consumed_input = incoming.filter(event_type__relationship="consume").exclude(resource_type=self.child) 80 | self.assertEqual(work_input.count(), 1) 81 | self.assertEqual(used_input.count(), 1) 82 | self.assertEqual(cited_input.count(), 1) 83 | self.assertEqual(consumed_input.count(), 1) 84 | child_input = incoming.filter(resource_type=self.child)[0] 85 | self.assertEqual(child_input.quantity, Decimal("2")) 86 | rt = child_input.resource_type 87 | child_output=rt.producing_commitments()[0] 88 | self.assertEqual(child_output.quantity, Decimal("2")) 89 | child_process=child_output.process 90 | grandchild_input = child_process.incoming_commitments()[0] 91 | self.assertEqual(grandchild_input.quantity, Decimal("6")) 92 | #import pdb; pdb.set_trace() 93 | 94 | def test_complete_recipe(self): 95 | """todo""" 96 | pass 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/create_exchange.html: -------------------------------------------------------------------------------- 1 | {% extends "site_base.html" %} 2 | 3 | {% load staticfiles %} 4 | {% load i18n %} 5 | {% load bootstrap_tags %} 6 | 7 | {% block head_title %}{% trans "Create Exchange" %}{% endblock %} 8 | 9 | {% block extra_head %} 10 | 11 | 12 | 13 | 32 | {% endblock %} 33 | 34 | {% block body_base %} 35 |
36 | {% include "_messages.html" %} 37 |
38 | {% if context_agent %} 39 | {% trans "Create Exchange" %} 40 |
41 | {% csrf_token %} 42 |
43 | {{ exchange_form|as_bootstrap }} 44 |
45 | 46 |
47 |
48 | 49 |
50 | 51 | {% else %} 52 |

You need a {{ context_types }}.

53 |

54 | Read the 55 | 56 | Network Setup tutorial 57 | and create one. 58 |

59 | {% endif %} 60 |
61 | 62 | {% endblock %} 63 | {% block extra_script %} 64 | 65 | 66 | 67 | {% endblock %} 68 | 69 | {% block extra_body %} 70 | {{ block.super }} 71 | 72 | 141 | 142 | {% endblock %} 143 | -------------------------------------------------------------------------------- /valuenetwork/templates/valueaccounting/processes_graph.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | {% load bootstrap_tags %} 3 | 4 | 5 | 6 | Process Graph 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 83 | 84 | 85 | 86 | 87 |
88 | 103 |
104 | 105 |
106 |
107 |
Loading...
108 |
109 | 110 | 111 | 139 | 140 | 141 | 142 | --------------------------------------------------------------------------------