1
from axiom.item import Item
2
from axiom import attributes
3
from zope.interface import implements
4
from xmantissa.webnav import Tab
5
from xmantissa.ixmantissa import INavigableElement, IBenefactor
6
from xmantissa.webadmin import ParentCounterMixin
7
from nevow import loaders, rend, livepage
8
from twisted.python.components import registerAdapter
9
from xmantissa.webadmin import WebSite, PrivateApplication
11
#class ClickChronicleApplication( PrivateApplication ):
12
#implements( INavigableElement )
13
#typeName = 'clickchronicle_application'
15
#urlCount = attributes.integer( default = 0 )
18
# self.store.powerUp( self, INavigableElement )
21
# return [Tab('Admin', self.storeID, 0.0,
22
# [Tab('Magical', self.storeID, 0.1)])]
24
#def createResource( self, a, b, c, d, e, f, g ):
27
from xmantissa.ixmantissa import INavigableFragment
29
timestamp = attributes.timestamp()
30
url = attributes.text()
35
from nevow.inevow import IResource, IQ
37
class LinkList( rend.Page ):
38
implements( IResource )
39
docFactory = loaders.xmlfile( 'linklist.xml' )
41
def __init__( self, *a, **k ):
42
rend.Page.__init__( self, *a, **k )
43
self.store = self.original.store
45
def data_links( self, ctx, data ):
46
for visit in self.store.query( Visit ):
47
yield dict( timestamp = visit.timestamp, url = visit.url )
49
class ClickChronicleApplication( Item, ParentCounterMixin ):
50
implements( INavigableElement )
51
typeName = 'clickchronicle_application'
53
urlCount = attributes.integer( default = 0 )
56
self.store.powerUp( self, INavigableElement )
59
return [Tab('Admin', self.storeID, 0.0,
60
[Tab('Magical', self.storeID, 0.1)])]
61
static = lambda value : lambda *a, **k: value
63
class ClickChronicleFragment( rend.Fragment ):
64
fragmentName = 'click-chronicle-fragment'
66
docFactory = loaders.xmlfile( 'linklist.xml' )
69
registerAdapter( ClickChronicleFragment, ClickChronicleApplication, INavigableFragment )
71
class ClickChronicleBenefactor( Item ):
72
implements( IBenefactor )
73
typeName = 'clickchronicle_benefactor'
76
endowed = attributes.integer( default = 0 )
78
def endow(self, ticket, avatar):
80
WebSite( store = avatar ).install()
81
PrivateApplication( store = avatar ).install()
82
ClickChronicleApplication( store = avatar ).install()
83
#for item in ( WebSite, PrivateApplication ):
84
# item( store = avatar ).install()