/usr/share/cherokee/admin/SelectionPanel.py is in cherokee-admin 1.2.101-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | # -*- coding: utf-8 -*-
#
# Cherokee-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
import CTK
import string
HEADER = ['<script type="text/javascript" src="/CTK/js/jquery.cookie.js"></script>',
'<script type="text/javascript" src="/static/js/SelectionPanel.js"></script>']
COOKIE_NAME_DEFAULT = "selection"
JS_INIT = """
$('#%(id)s').SelectionPanel ('%(table_id)s', '%(content_id)s', '%(cookie)s', '%(cookie_domain)s', '%(web_empty)s');
"""
class SelectionPanel (CTK.Box):
def __init__ (self, callback, content_id, web_url, web_empty, draggable=True, container=None, cookie_name=COOKIE_NAME_DEFAULT):
CTK.Box.__init__ (self, {'class': 'selection-panel', 'style':'display:none;'})
self.table = CTK.SortableList (callback, container)
self.content_id = content_id
self.web_url = web_url
self.web_empty = web_empty
self.draggable = draggable
self.cookie_name = cookie_name
self += self.table
def Add (self, id_content, url, content, draggable=True, extraClass=''):
assert type(url) == str
assert type(content) == list
# Row ID
row_id = ''.join([('_',x)[x in string.letters+string.digits] for x in url])
# Row Content
row_content = CTK.Box({'class': 'row_content ' + extraClass,
'pid': id_content,
'url': url})
for w in content:
row_content += w
# Add to the table
self.table += [None, row_content]
self.table[-1].props['id'] = id_content
self.table[-1][2].props['class'] = "nodrag nodrop"
# Draggable
if self.draggable and draggable:
self.table[-1][1].props['class'] = 'dragHandle'
else:
self.table[-1][1].props['class'] = 'nodragHandle'
self.table[-1].props['class'] = 'nodrag nodrop'
def Render (self):
render = CTK.Box.Render (self)
props = {'id': self.id,
'table_id': self.table.id,
'content_id': self.content_id,
'cookie': self.cookie_name,
'cookie_domain': self.web_url,
'web_empty': self.web_empty}
render.js += JS_INIT %(props)
render.headers += HEADER
return render
|