cc1  v2.1
CC1 source code docs
All Classes Namespaces Files Functions Variables Pages
iso_image.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.user.iso_image
22 # @author Piotr Wójcik
23 # @date 19.11.2010
24 #
25 
26 from django.conf.urls import patterns, url, include
27 from django.utils.translation import ungettext, ugettext_lazy as _
28 
29 from wi.forms.iso_image import EditISOForm
30 from wi.utils.decorators import user_permission
31 from wi.utils.views import direct_to_template, form_generic_id, generic_multiple_id
32 
33 
34 resources_patterns = patterns('wi.views.user.iso_image',
35 
36  url(r'^iso/$', user_permission(direct_to_template), {'template_name': 'resources/iso.html'}, name='res_iso'),
37  url(r'^ajax/iso_table/$', 'res_ajax_get_iso_table', name='res_ajax_get_iso_table'),
38  url(r'^ajax/upload_iso_http/$', 'res_ajax_upload_iso_http', name='res_ajax_upload_iso_http'),
39  url(r'^ajax/edit_iso/(?P<id1>\d+)/$', user_permission(form_generic_id),
40  {'template_name': 'generic/form.html',
41  'success_msg': (lambda desc, data: _('ISO image data edited.') % {'desc': desc}),
42  'ask_msg': (lambda desc: _('Edit ISO image data:') % {'desc': desc}),
43  'confirmation': _('Save'),
44  'request_url_post': 'user/iso_image/edit/',
45  'request_url_get': 'user/iso_image/get_by_id/',
46  'request_url_both': {'disk_controllers': 'user/iso_image/get_disk_controllers/'},
47  'id_key': 'iso_image_id',
48  'form_class': EditISOForm},
49  name='res_ajax_edit_iso'),
50  url(r'^ajax/delete_iso/$', user_permission(generic_multiple_id),
51  {'template_name': 'generic/simple.html',
52  'success_msg': (lambda desc, count: ungettext('You have successfully deleted ISO image <b>%(desc)s</b>.', 'You have successfully deleted %(count)s ISO images <b>%(desc)s</b>.', count) % {'desc': desc, 'count': count}),
53  'ask_msg': (lambda desc, count: ungettext('Do you really want to delete ISO image <b>%(desc)s</b>?', 'Do you really want to delete %(count)s ISO images <b>%(desc)s</b>?', count) % {'desc': desc, 'count': count}),
54  'request_url': 'user/iso_image/delete/',
55  'id_key': 'iso_image_ids'
56  },
57  name='res_ajax_delete_iso'),
58 )
59 
60 urlpatterns = patterns('',
61  url(r'^resources/', include(resources_patterns)),
62 )
63