relooked big lists
This commit is contained in:
parent
74fb6ba30d
commit
ea6e3ea34a
|
@ -7,7 +7,7 @@ import lasso
|
|||
from quixote import get_session, redirect
|
||||
from quixote.directory import Directory
|
||||
|
||||
from menu import html_top, html_foot
|
||||
from menu import *
|
||||
|
||||
from authentic import audit
|
||||
from authentic import errors
|
||||
|
@ -191,38 +191,34 @@ class IdentitiesDirectory(Directory):
|
|||
|
||||
identities_list.sort(lambda x,y: cmp(x.uid, y.uid))
|
||||
session = get_session()
|
||||
'<div class="biglist">'
|
||||
'<ul class="biglist">'
|
||||
for identity in identities_list:
|
||||
if session and session.user == identity.uid:
|
||||
"""<div class="biglist-item myself">"""
|
||||
'<li class="myself">'
|
||||
else:
|
||||
"""<div class="biglist-item">"""
|
||||
"""<h3 class="identity-title">""" + str(identity) + """</h3>"""
|
||||
"""<p>"""
|
||||
"""<span class="data">"""
|
||||
"""<span class="uid">""" + identity.uid + "</span> "
|
||||
'<li>'
|
||||
'<strong>%s</strong>' % str(identity)
|
||||
'<p class="details">'
|
||||
'<span class="uid">%s</span> ' % identity.uid
|
||||
if identity.name:
|
||||
"""<span class="name">""" + identity.name + "</span> "
|
||||
'<span class="name">%s</span> ' % identity.name
|
||||
if identity.lasso_dump:
|
||||
lasso_identity = lasso.Identity.newFromDump(identity.lasso_dump)
|
||||
nb_federations = len(lasso_identity.providerIds)
|
||||
if nb_federations == 1:
|
||||
"""<span class="federations">(%d %s)</span>""" % (
|
||||
'<span class="federations">(%d %s)</span>' % (
|
||||
nb_federations, _('federation'))
|
||||
else:
|
||||
"""<span class="federations">(%d %s)</span>""" % (
|
||||
'<span class="federations">(%d %s)</span>' % (
|
||||
nb_federations, _('federations'))
|
||||
"""</span>"""
|
||||
"""<span class="cmds">[ """
|
||||
"""<a href="%s">%s</a> - """ % (identity.uid, _('View'))
|
||||
"""<a href="%s/edit">%s</a>""" % (identity.uid, _('Edit'))
|
||||
'</p>'
|
||||
'<p class="commands">'
|
||||
command_icon('%s/' % identity.uid, 'view')
|
||||
command_icon('%s/edit' % identity.uid, 'edit')
|
||||
if hasattr(identities.store, str('remove')):
|
||||
"""- <a href="%s/delete">%s</a> """ % (identity.uid, _('Delete'))
|
||||
"""]</span></p></div>"""
|
||||
|
||||
"""
|
||||
</div>
|
||||
"""
|
||||
command_icon('%s/delete' % identity.uid, 'remove')
|
||||
'</p></li>'
|
||||
'</ul>'
|
||||
html_foot()
|
||||
|
||||
def new [html] (self):
|
||||
|
|
|
@ -67,3 +67,22 @@ def html_top [html] (section, title = None):
|
|||
def html_foot [html] ():
|
||||
return """</div><div id="footer"><p id="lasso">Powered by Lasso</p></div></body></html>"""
|
||||
|
||||
def command_icon [html] (url, type, label = None, icon = None):
|
||||
icons = {
|
||||
'edit': 'stock_edit_16.png',
|
||||
'remove': 'stock_remove_16.png',
|
||||
'view': 'stock_file_16.png',
|
||||
}
|
||||
labels = {
|
||||
'edit': N_('Edit'),
|
||||
'remove': N_('Remove'),
|
||||
'view': N_('View'),
|
||||
}
|
||||
if not label:
|
||||
label = _(labels[str(type)])
|
||||
if not icon:
|
||||
icon = icons[str(type)]
|
||||
'''<span class="%(type)s">
|
||||
<a href="%(url)s"><img src="/images/%(icon)s" alt="%(label)s" title="%(label)s" /></a>
|
||||
</span>''' % locals()
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ from quixote import errors
|
|||
from quixote.html import htmltext
|
||||
from quixote.util import dump_request
|
||||
|
||||
from menu import html_top, html_foot
|
||||
from menu import *
|
||||
|
||||
import authentic
|
||||
from authentic import identities
|
||||
|
@ -29,7 +29,7 @@ class LibertyProvidersDir(Directory):
|
|||
"<h2>%s</h2>" % _('Liberty Providers')
|
||||
'<ul id="nav-admin"> <li><a href="new">%s</a></li> </ul>' % _('New')
|
||||
|
||||
'<div class="biglist">'
|
||||
'<ul class="biglist">'
|
||||
for klp, lp in misc.cfg.get('providers', {}).items():
|
||||
publickey_fn = None
|
||||
cacertchain_fn = None
|
||||
|
@ -43,22 +43,23 @@ class LibertyProvidersDir(Directory):
|
|||
if p.providerId == '':
|
||||
pass
|
||||
except TypeError:
|
||||
'<div class="biglist-item">'
|
||||
'<h3>%s (%s)</h3>' % (_('Broken'), klp)
|
||||
'<span class="cmds">[ '
|
||||
'<a href="%s/delete">%s</a> ' % (klp, _('Delete'))
|
||||
']</span></p></div>'
|
||||
'<li>'
|
||||
'<strong>%s (%s)</strong>' % (_('Broken'), klp)
|
||||
'<p class="commands">'
|
||||
command_icon('%s/delete' % klp, 'remove')
|
||||
'</p>'
|
||||
'</li>'
|
||||
continue
|
||||
|
||||
'<div class="biglist-item">'
|
||||
"<h3>%s</h3>" % htmltext(misc.get_provider_label(p))
|
||||
'<p><span class="data">%s</span>' % p.providerId # XXX: tell sp/idp
|
||||
'<span class="cmds">[ '
|
||||
'<a href="%s">%s</a> - ' % (klp, _('View'))
|
||||
'<a href="%s/edit">%s</a> - ' % (klp, _('Edit'))
|
||||
'<a href="%s/delete">%s</a> ' % (klp, _('Delete'))
|
||||
']</span></p></div>'
|
||||
'</div>'
|
||||
'<li>'
|
||||
'<strong>%s</strong>' % htmltext(misc.get_provider_label(p))
|
||||
'<p class="details"><span class="data">%s</span></p>' % p.providerId # XXX: tell sp/idp
|
||||
'<p class="commands">'
|
||||
command_icon('%s/' % klp, 'view')
|
||||
command_icon('%s/edit' % klp, 'edit')
|
||||
command_icon('%s/delete' % klp, 'remove')
|
||||
'</p></li>'
|
||||
'</ul>'
|
||||
html_foot()
|
||||
|
||||
def _q_lookup(self, component):
|
||||
|
@ -437,7 +438,7 @@ class SettingsDirectory(Directory):
|
|||
'<form action="themes" enctype="multipart/form-data" method="post">'
|
||||
theme_files = glob.glob(os.path.join(authentic.DATA_DIR, str('themes/*/desc.xml')))
|
||||
theme_files.sort()
|
||||
'<div class="biglist">'
|
||||
'<ul class="biglist">'
|
||||
for t in theme_files:
|
||||
dom = xml.dom.minidom.parseString(open(t).read())
|
||||
theme = dom.getElementsByTagName('theme')[0].attributes['name'].value
|
||||
|
@ -445,16 +446,18 @@ class SettingsDirectory(Directory):
|
|||
checked = ' checked="checked"'
|
||||
else:
|
||||
checked = ''
|
||||
'<div class="biglist-item">'
|
||||
'<h3><input name="theme" value="%s" type="radio"%s>%s</input></h3>' % (
|
||||
'<li>'
|
||||
'<strong class="label">'
|
||||
' <input name="theme" value="%s" type="radio"%s>%s</input></strong>' % (
|
||||
theme, checked, getText(dom.getElementsByTagName('label')[0].childNodes))
|
||||
icon_file = t.replace(str('desc.xml'), str('icon.png'))
|
||||
if os.path.exists(icon_file):
|
||||
'<img src="/themes/%s/icon.png" alt="" class="theme-icon" />' % theme
|
||||
"<p>%s</p>" % getText(dom.getElementsByTagName('desc')[0].childNodes)
|
||||
"<p>by %s</p>" % getText(dom.getElementsByTagName('author')[0].childNodes)
|
||||
'</div>'
|
||||
'</div>'
|
||||
'<p class="details">%s<br />by %s</p>' % (
|
||||
getText(dom.getElementsByTagName('desc')[0].childNodes),
|
||||
getText(dom.getElementsByTagName('author')[0].childNodes))
|
||||
'</li>'
|
||||
'</ul>'
|
||||
'<div class="buttons">'
|
||||
'<input type="submit" name="submit" value="%s" />' % _('Submit')
|
||||
'</div>'
|
||||
|
|
|
@ -253,8 +253,6 @@ class RootDirectory(Directory):
|
|||
if identities_cfg.get('creation') == 'self':
|
||||
'<p id="register"><a href="register">%s</a></p>' % _('Register a new account')
|
||||
|
||||
self.more_login_text()
|
||||
|
||||
"""</div>
|
||||
<script type="text/javascript">
|
||||
document.forms[0]['username'].focus();
|
||||
|
|
|
@ -26,39 +26,6 @@ div.AccountSettingWidget label {
|
|||
padding-right: 2em;
|
||||
}
|
||||
|
||||
div.biglist-item {
|
||||
border: 1px solid #aaa;
|
||||
margin-bottom: 1em;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
div.biglist-item h3 {
|
||||
margin: 0;
|
||||
border-bottom: 1px solid #aaa;
|
||||
font-weight: normal;
|
||||
background: #ddd;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
div.biglist-item h3.identity-title {
|
||||
background: #ddd url(ico_user.png) 1px center no-repeat;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
div.biglist-item p {
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
div.biglist-item span.data {
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.biglist-item span.cmds {
|
||||
font-size: 80%;
|
||||
display: block;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#header {
|
||||
max-width: 700px;
|
||||
margin: 0 8em;
|
||||
|
@ -202,6 +169,42 @@ div#error {
|
|||
|
||||
img.theme-icon {
|
||||
float: right;
|
||||
margin: 2px;
|
||||
margin: -16px 4px 0px 3px;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
ul.biglist {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.biglist li {
|
||||
list-style-type: none;
|
||||
margin: 4px 0;
|
||||
padding: 0 2px;
|
||||
border: 1px solid #888;
|
||||
background: #ffe;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
ul.biglist li p.details {
|
||||
display: block;
|
||||
margin: 0;
|
||||
color: #555;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
|
||||
ul.biglist li p.commands {
|
||||
float: right;
|
||||
margin-top: -17px;
|
||||
}
|
||||
|
||||
ul.biglist li p.commands img {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
a img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue