cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
storage.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 ##
21 # @package src.wi.urls.admin_cm.storage
22 #
23 # @author Krzysztof Danielowski, Piotr Wojcik
24 # @date 17.03.2011
25 #
26 
27 from django.conf.urls import url, patterns, include
28 from django.utils.translation import ugettext_lazy as _
29 
30 from wi.forms.storage import StorageForm
31 from wi.utils.decorators import admin_cm_permission
32 from wi.utils.views import direct_to_template, simple_generic_id, form_generic
33 
34 
35 storage_patterns = patterns('wi.views.admin_cm.storage',
36  url(r'^storages/$', admin_cm_permission(direct_to_template), {'template_name': 'admin_cm/storages.html'}, name='cma_storages'),
37  url(r'^ajax/get_table_storages/$', 'cma_ajax_get_table_storages', name='cma_ajax_get_table_storages'),
38  url(r'^ajax/add_storage/$', admin_cm_permission(form_generic),
39  {'template_name': 'generic/form.html',
40  'success_msg': (lambda desc, data: _('You have successfully created a storage.') % {'desc': desc}),
41  'confirmation': _('Create'),
42  'request_url_post': 'admin_cm/storage/create/',
43  'form_class': StorageForm},
44  name='cma_ajax_add_storage'),
45  url(r'^ajax/lock_storage/(?P<id1>\d+)/$', admin_cm_permission(simple_generic_id),
46  {'template_name': 'generic/simple.html',
47  'success_msg': (lambda desc: _('You have successfully locked storage <b>%(desc)s</b>.') % {'desc': desc}),
48  'ask_msg': (lambda desc: _('Do you want to lock storage <b>%(desc)s</b>?') % {'desc': desc}),
49  'request_url': 'admin_cm/storage/lock/',
50  'id_key': 'storage_id', },
51  name='cma_ajax_lock_storage'),
52  url(r'^ajax/delete_storage/(?P<id1>\d+)/$', admin_cm_permission(simple_generic_id),
53  {'template_name': 'generic/simple.html',
54  'success_msg': (lambda desc: _('You have successfully deleted storage <b>%(desc)s</b>.') % {'desc': desc}),
55  'ask_msg': (lambda desc: _('Do you want to delete storage <b>%(desc)s</b>?') % {'desc': desc}),
56  'request_url': 'admin_cm/storage/delete/',
57  'id_key': 'storage_id', },
58  name='cma_ajax_delete_storage'),
59  url(r'^ajax/unlock_storage/(?P<id1>\d+)/$', admin_cm_permission(simple_generic_id),
60  {'template_name': 'generic/simple.html',
61  'success_msg': (lambda desc: _('You have successfully unlocked storage <b>%(desc)s</b>.') % {'desc': desc}),
62  'ask_msg': (lambda desc: _('Do you want to unlock storage <b>%(desc)s</b>?') % {'desc': desc}),
63  'request_url': 'admin_cm/storage/unlock/',
64  'id_key': 'storage_id', },
65  name='cma_ajax_unlock_storage'),
66  url(r'^ajax/mount_node/(?P<storage_id>\d+)/$', 'cma_ajax_mount_node', name='cma_ajax_mount_node'),
67 
68  url(r'^ajax/mount_rm/(?P<id1>\d+)/$', admin_cm_permission(simple_generic_id),
69  {'template_name': 'generic/simple.html',
70  'success_msg': (lambda desc: _('You have successfully mounted strorage to RM.') % {'desc': desc}),
71  'ask_msg': (lambda desc: _('Do you want to mount storage to RM?') % {'desc': desc}),
72  'request_url': 'admin_cm/storage/mount_rm/',
73  'id_key': 'storage_id', },
74  name='cma_ajax_mount_rm'),
75 )
76 
77 urlpatterns = patterns('',
78  url(r'^admin_cm/', include(storage_patterns)),
79 )
80