# Path: goflow/apptools/forms.py
# class DefaultAppStartForm(StartForm):
#     def save(self,  user=None, data=None, commit=True):
#         ob = super(DefaultAppStartForm, self).save(commit=False)
#         if not ob.history:
#             ob.history = 'Init'
#         ob.history += '\n%s start instance' % datetime.now().isoformat(' ')
#         if ob.comment:
#             ob.history += '\n---------'
#             ob.history += '\n%s' % ob.comment
#             ob.comment = None
#         ob.save()
#         return ob
# 
#     class Meta:
#          model = DefaultAppModel
#          exclude = ('reasonDenial',)
# 
# Path: goflow/apptools/views.py
# def start_application(request, app_label=None, model_name=None, process_name=None, instance_label=None,
#                        template=None, template_def='goflow/start_application.html',
#                        form_class=None, redirect='home', submit_name='action',
#                        ok_value='OK', cancel_value='Cancel', extra_context={}):
# def default_app(request, id, template='goflow/default_app.html', redirect='../../', submit_name='action'):
# def _cond_to_button_value(cond):
# def edit_model(request, id, form_class, cmp_attr=None,template=None, template_def='goflow/edit_model.html', title="",
#                redirect='home', submit_name='action', ok_values=('OK',), save_value=None, cancel_value='Cancel',
#                extra_context={}):
# def view_application(request, id, template='goflow/view_application.html', redirect='home', title="",
#                submit_name='action', ok_values=('OK',), cancel_value='Cancel',
#                extra_context={}):
# def choice_application(request, id, template='goflow/view_application_image.html', redirect='home', title="Choice",
#                submit_name='image', cancel_action='cancel', extra_context={}):
# def sendmail(workitem, subject='goflow.apptools sendmail message', template='goflow/app_sendmail.txt'):
# def override_app_params(activity, name, value):
# def app_env(request, action, id, template=None):
# def test_start(request, id, template='goflow/test_start.html'):
# def image_update(request):


from django.conf.urls import *
from django.conf import settings
from .apptools.forms import DefaultAppStartForm
from .apptools.views import DefaultAppModel

urlpatterns = patterns('django.contrib.auth.views',
    (r'^.*/logout/$', 'logout'),
    (r'^.*/accounts/login/$', 'login', {'template_name':'goflow/login.html'}),
    (r'^apptools/', include('goflow.apptools.urls')),
    (r'^graph/', include('goflow.graphics.urls')),
)

urlpatterns += patterns('goflow.workflow.views',
    (r'^$', 'index'),
    (r'^process/dot/(?P<id>.*)$','process_dot'),
    (r'^cron/$','cron'),
)

urlpatterns += patterns('goflow.apptools.views',
    (r'^default_app/(?P<id>.*)/$', 'default_app'),
    (r'^start/(?P<app_label>.*)/(?P<model_name>.*)/$', 'start_application'),
    (r'^start_proto/(?P<process_name>.*)/$', 'start_application',

# Path: goflow/apptools/forms.py
# class DefaultAppStartForm(StartForm):
#     def save(self,  user=None, data=None, commit=True):
#         ob = super(DefaultAppStartForm, self).save(commit=False)
#         if not ob.history:
#             ob.history = 'Init'
#         ob.history += '\n%s start instance' % datetime.now().isoformat(' ')
#         if ob.comment:
#             ob.history += '\n---------'
#             ob.history += '\n%s' % ob.comment
#             ob.comment = None
#         ob.save()
#         return ob
# 
#     class Meta:
#          model = DefaultAppModel
#          exclude = ('reasonDenial',)
# 
# Path: goflow/apptools/views.py
# def start_application(request, app_label=None, model_name=None, process_name=None, instance_label=None,
#                        template=None, template_def='goflow/start_application.html',
#                        form_class=None, redirect='home', submit_name='action',
#                        ok_value='OK', cancel_value='Cancel', extra_context={}):
# def default_app(request, id, template='goflow/default_app.html', redirect='../../', submit_name='action'):
# def _cond_to_button_value(cond):
# def edit_model(request, id, form_class, cmp_attr=None,template=None, template_def='goflow/edit_model.html', title="",
#                redirect='home', submit_name='action', ok_values=('OK',), save_value=None, cancel_value='Cancel',
#                extra_context={}):
# def view_application(request, id, template='goflow/view_application.html', redirect='home', title="",
#                submit_name='action', ok_values=('OK',), cancel_value='Cancel',
#                extra_context={}):
# def choice_application(request, id, template='goflow/view_application_image.html', redirect='home', title="Choice",
#                submit_name='image', cancel_action='cancel', extra_context={}):
# def sendmail(workitem, subject='goflow.apptools sendmail message', template='goflow/app_sendmail.txt'):
# def override_app_params(activity, name, value):
# def app_env(request, action, id, template=None):
# def test_start(request, id, template='goflow/test_start.html'):
# def image_update(request):


# Path: goflow/urls.py
from django.conf.urls import *
from django.conf import settings
from .apptools.forms import DefaultAppStartForm
from .apptools.views import DefaultAppModel


urlpatterns = patterns('django.contrib.auth.views',
    (r'^.*/logout/$', 'logout'),
    (r'^.*/accounts/login/$', 'login', {'template_name':'goflow/login.html'}),
    (r'^apptools/', include('goflow.apptools.urls')),
    (r'^graph/', include('goflow.graphics.urls')),
)

urlpatterns += patterns('goflow.workflow.views',
    (r'^$', 'index'),
    (r'^process/dot/(?P<id>.*)$','process_dot'),
    (r'^cron/$','cron'),
)

urlpatterns += patterns('goflow.apptools.views',
    (r'^default_app/(?P<id>.*)/$', 'default_app'),
    (r'^start/(?P<app_label>.*)/(?P<model_name>.*)/$', 'start_application'),
    (r'^start_proto/(?P<process_name>.*)/$', 'start_application',

        {'form_class':DefaultAppStartForm,