26 | {{ orphan }} created by: {{ orphan.created_by }} created date: {{ orphan.created_date }}
27 |
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 |
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" %}:
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 | 
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 |
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 |
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 |
38 | {% endif %}
39 | {% if orphan.is_deletable %}
40 |
50 | {% endif %}
51 |
97 | Zoom using mousewheel or touchpad scroll. Slide the whole graph like a map, or move a node.
98 | Click a node to freeze it, click again to unfreeze.
99 | Double-click a node to open its own page.
100 | Processes horizontally positioned by date, width by duration.
101 |