Changeset 29
- Timestamp:
- 12/30/06 02:30:39 (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 modified
-
cogplanet/admin/controller.py (modified) (8 diffs)
-
cogplanet/controllers.py (modified) (1 diff)
-
cogplanet/model.py (modified) (1 diff)
-
cogplanet/static/css/style.css (modified) (1 diff)
-
cogplanet/templates/admin/layout.html (modified) (3 diffs)
-
cogplanet/templates/admin/planet.html (added)
-
cogplanet/templates/index.html (modified) (1 diff)
-
dev.cfg (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/cogplanet/admin/controller.py
r20 r29 2 2 3 3 from turbogears import database 4 from turbogears import controllers, expose, url 4 from turbogears import controllers, expose, url, error_handler 5 5 from turbogears import identity, redirect 6 6 from turbogears import validate 7 from turbogears import validators 7 8 from turbogears.widgets import * 8 9 … … 10 11 from cogplanet.model import * 11 12 from cogplanet.util import * 13 14 class PlanetFields(WidgetsList): 15 id = HiddenField(name="id") 16 name = TextField(name="name", attrs={'size':60}) 17 display_entries = TextField(name="display_entries", 18 label="Entries to display", 19 validator=validators.Number(), 20 attrs={'size': 60}) 21 update_interval = TextField(name="update_interval", 22 label="Update Interval (Minutes)", 23 validator=validators.Number(), 24 attrs={'size': 60}) 25 26 class PlanetForm(TableForm): 27 fields = PlanetFields() 28 submit_text = "Save Changes" 12 29 13 30 class FeedFields(WidgetsList): … … 17 34 xmlurl = TextField(name="xmlurl", label="XML URL", attrs={'size': 60}) 18 35 updated_at = CalendarDateTimePicker(name="updated_at", label="Updated At") 19 update_interval = TextField(name="update_interval", label="Update Interval (Minutes)", attrs={'size': 60}) 36 update_interval = TextField(name="update_interval", 37 label="Update Interval (Minutes)", 38 validator=validators.Number(), 39 attrs={'size': 60}) 20 40 21 41 class FeedForm(TableForm): … … 33 53 feed_form = FeedForm() 34 54 import_form = ImportForm() 55 planet_form = PlanetForm() 35 56 36 57 @expose() … … 47 68 entry = Entry.selectone(Entry.c.id==id) 48 69 print entry.content 49 return({'entry':entry}) 70 planet = Planet.selectone() 71 return({'entry':entry, 72 'planet':planet}) 50 73 51 74 @expose(template="cogplanet.templates.admin.import_feeds") … … 55 78 if opml_file != None: 56 79 import_opml(opml_file.file) 80 planet = Planet.selectone() 57 81 # TODO should return the number of feeds imported 58 return({'import_form': self.import_form}) 82 return({'import_form': self.import_form, 83 'planet':planet}) 84 85 @expose(template="cogplanet.templates.admin.planet") 86 @identity.require(identity.in_group("cp_admin")) 87 def planet_view(self): 88 planet = Planet.selectone() 89 return({'planet': planet, 90 'planet_form': self.planet_form}) 91 92 @expose() 93 @validate(planet_form) 94 @error_handler(planet_view) 95 @identity.require(identity.in_group("cp_admin")) 96 def planet_update(self, **kw): 97 planet = Planet.selectone() 98 planet.name = kw['name'] 99 planet.display_entries = kw['display_entries'] 100 planet.update_interval = kw['update_interval'] 101 raise cherrypy.HTTPRedirect('./planet_view') 59 102 60 103 @expose() … … 97 140 if(id != 'new'): 98 141 feed = Feed.selectone("id=%d" % int(id)) 142 planet = Planet.selectone() 99 143 return({'feed': feed, 100 'feed_form': self.feed_form}) 144 'feed_form': self.feed_form, 145 'planet': planet}) 101 146 102 147 @expose(template="cogplanet.templates.admin.index") … … 104 149 def index(self): 105 150 feeds = Feed.select(order_by="name") 106 return({"feeds": feeds}) 151 planet = Planet.selectone() 152 return({"feeds": feeds, 153 'planet': planet}) -
trunk/cogplanet/controllers.py
r21 r29 37 37 # @identity.require(identity.in_group("admin")) 38 38 def index(self): 39 entries = Entry.select(Entry.c.parsed == True, order_by="updated_at DESC", limit=10) 39 planet = Planet.selectone() 40 entries = Entry.select(Entry.c.parsed == True, 41 order_by="updated_at DESC", 42 limit=planet.display_entries) 40 43 feeds = Feed.select(order_by="name ASC") 41 planet = Planet.selectone()42 44 return {"entries":entries, 43 45 "feeds":feeds, -
trunk/cogplanet/model.py
r21 r29 19 19 id = column(Integer, primary_key=True) 20 20 name = column(Unicode, nullable=False) 21 display_entries = column(Integer, default=50, nullable=False) 21 22 update_interval = column(Integer, default=1440, nullable=False) 22 23 # TODO cascade='delete' (currently unsupported) -
trunk/cogplanet/static/css/style.css
r27 r29 67 67 } 68 68 69 #header h1, #header h2 { 70 margin: 0; 71 padding: 0; 72 } 73 69 74 #menu { 70 75 background-color: #000; -
trunk/cogplanet/templates/admin/layout.html
r10 r29 2 2 3 3 <head> 4 <title>${p age_title()}</title>4 <title>${planet.name} ${page_title()}</title> 5 5 <link href="/static/css/style.css" type="text/css" rel="stylesheet" /> 6 6 </head> … … 8 8 <body> 9 9 <div id="header"> 10 <h1>CogPlanet :: ${page_title()}</h1> 10 <h1>${planet.name}</h1> 11 <h2>${page_title()}</h2> 11 12 </div> 12 13 <ul id="menu"> 13 14 <li><a href="" py:attrs="{'href': tg.url('/admin')}">Admin Home</a></li> 15 <li><a href="" py:attrs="{'href': tg.url('/admin/planet_view')}">Configuration</a></li> 14 16 <li><a href="" py:attrs="{'href': tg.url('/admin/new/view')}">Add a Feed</a></li> 15 17 <li><a href="" py:attrs="{'href': tg.url('/admin/import_feeds')}">Import OPML</a></li> … … 18 20 <div id="main_content"><content>Default content</content></div> 19 21 20 <div id="footer">Page Footer Text</div> 22 <div id="footer"> 23 <span style="float:left;">Powered by <a href="http://achievewith.us/projects/cogplanet">CogPlanet</a></span> 24 <span style="float:right;">Built on <a href="http://turbogears.org">TurboGears</a></span> 25 </div> 21 26 </body> 22 27 -
trunk/cogplanet/templates/index.html
r27 r29 6 6 7 7 <div py:match="content"> 8 <div py:if="len(feeds) == 0"> 9 <h1>Welcome</h1> 10 11 <p>This looks like a new planet, so you are probably the new planet 12 administrator. You should log in to 13 the <a href="./admin">administration section</a> and add the feeds 14 that you want to aggregate.</p> 15 16 <p>If you have any trouble using CogPlanet, or you feel a desire to 17 improve this software, visit 18 the <a href="http://achievewith.us/projects/cogplanet">CogPlanet 19 Trac</a>.</p> 20 21 </div> 22 8 23 9 24 <div py:for="entry in entries"> -
trunk/dev.cfg
r28 r29 5 5 # cogplanet/config/app.cfg 6 6 7 easy_config.enabled = False 7 easy_config.enabled = True 8 tg.scheduler = True 8 9 9 10 # DATABASE
