Changeset 18
- Timestamp:
- 11/09/06 12:35:18 (5 years ago)
- Location:
- sitemap-plugin/trunk
- Files:
-
- 4 added
- 1 deleted
- 4 edited
-
COPYING (added)
-
setup.cfg (added)
-
setup.py (modified) (2 diffs)
-
sitemap/__init__.py (modified) (1 diff)
-
sitemap/admin_ui.py (modified) (1 diff)
-
sitemap/api.py (added)
-
sitemap/google.py (deleted)
-
sitemap/templates/sitemap_admin.cs (modified) (3 diffs)
-
sitemap/wiki.py (added)
Legend:
- Unmodified
- Added
- Removed
-
sitemap-plugin/trunk/setup.py
r15 r18 1 1 #!/usr/bin/env python 2 2 3 from setuptools import setup , find_packages3 from setuptools import setup 4 4 5 5 PACKAGE = 'sitemap' … … 10 10 author_email = 'christian@wilde-welt.de', 11 11 url = 'http://voidblog.de/wiki/GoogleSitemap', 12 description = ' Google sitemap generator',12 description = 'Various sitemap generators', 13 13 license='BSD', 14 package_dir = { 'sitemap' : 'sitemap' },15 14 packages = ['sitemap'], 16 15 package_data = { 'sitemap' : [ 'templates/*.cs', ]}, -
sitemap-plugin/trunk/sitemap/__init__.py
r15 r18 1 import api 2 import wiki 1 3 try: 2 from admin import *4 from admin_ui import * 3 5 except ImportError: 4 6 pass 5 import google6 import admin_ui -
sitemap-plugin/trunk/sitemap/admin_ui.py
r15 r18 1 from pkg_resources import resource_filename 1 from pkg_resources import resource_filename #@UnresolvedImport 2 2 from webadmin.web_ui import IAdminPageProvider 3 3 from trac.web.chrome import ITemplateProvider 4 from trac.perm import IPermissionRequestor5 4 from trac.core import implements 6 5 from trac.core import Component 7 6 7 from api import SitemapController 8 8 9 class SitemapAdmin (Component):9 class SitemapAdminPage(Component): 10 10 """ 11 11 Generates a sitemap file suitable for Google Sitemaps 12 12 """ 13 13 14 implements(ITemplateProvider, IAdminPageProvider, IPermissionRequestor) 14 implements(ITemplateProvider, IAdminPageProvider) 15 16 priorities = [ 1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 ] 17 frequencies = [ 'never', 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'always'] 15 18 16 # IPermissionRequestor 17 def get_permission_actions(self): 18 return ['BLOG_ADMIN'] 19 19 def _get_field(self, req, name, default_value): 20 if name in req.args: 21 return req.args[name] 22 return default_value 23 20 24 # IAdminPageProvider methods 21 25 def get_admin_pages(self, req): 22 if req.perm.has_permission(' BLOG_ADMIN'):23 yield ('general', 'General', 'sitemap ', 'Sitemap')26 if req.perm.has_permission('TRAC_ADMIN'): 27 yield ('general', 'General', 'sitemap_admin', 'Sitemap') 24 28 25 29 def process_admin_request(self, req, cat, page, path_info): 26 assert req.perm.has_permission('BLOG_ADMIN') 30 assert req.perm.has_permission('TRAC_ADMIN') 31 c = SitemapController(self.env) 27 32 28 # add_stylesheet(req, 'blog/css/blog.css') 29 # add_stylesheet(req, 'common/css/wiki.css') 30 req.hdf['sitemap.url'] = req.base_url + '/sitemap.xml' 31 req.hdf['sitemap.priorities'] = [ 1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 ] 32 req.hdf['sitemap.frequencies'] = [ 'monthly', 'weekly', 'daily'] 33 if req.method == 'POST': 34 if page == 'sitemap': 35 if 'save' in req.args: 36 for contributor in c.contributors: 37 name, title = contributor.get_name() #@UnusedVariable 38 contributor.set_configuration( 39 self._get_field(req, name + '_priority', contributor.priority), 40 self._get_field(req, name + '_frequency', contributor.frequency) 41 ) 42 43 req.hdf['sitemap.data'] = c.get_descriptions() 44 req.hdf['sitemap.url'] = c.path 45 req.hdf['sitemap.priorities'] = self.priorities 46 req.hdf['sitemap.frequencies'] = self.frequencies 33 47 return 'sitemap_admin.cs', None 34 48 -
sitemap-plugin/trunk/sitemap/templates/sitemap_admin.cs
r16 r18 1 1 <form class="mod" method="post"> 2 2 <h2>Google Sitemap™ settings</h2> 3 <p> The URL of the Google sitemap is: <?cs var:sitemap.url ?></p>3 <p>What ressources should be included in your sitemap located at <strong><?cs var:sitemap.url ?></strong>?</p> 4 4 <table class="listing" id="sitemaplist" style="width:100%;margin-bottom:2em;"> 5 5 <colgroup> … … 11 11 <thead> 12 12 <tr> 13 <th class="sel"> </th>13 <th class="sel">Auto-update</th> 14 14 <th>Source</th> 15 15 <th>Priority</th> … … 18 18 </thead> 19 19 <tbody> 20 <?cs each:item = sitemap.data ?> 20 21 <tr> 21 <td><input type="checkbox" name="wiki" value="1"/></td> 22 <td><strong>Wiki pages</strong></td> 23 <td><select> 22 <td align="center"><input type="checkbox" name="handle_<?cs name:item ?>" value="1" <?cs 23 if:item.handle ?> checked="checked" <?cs /if ?> /></td> 24 <td><strong><?cs var:item.title ?></strong></td> 25 <td><select name="<?cs name:item ?>_priority"> 24 26 <?cs each:priority = sitemap.priorities ?> 25 <option value="<?cs var:priority ?>" ><?cs var:priority ?></option>27 <option value="<?cs var:priority ?>" <?cs if:priority == item.priority ?>selected="selected"<?cs /if ?>><?cs var:priority ?></option> 26 28 <?cs /each ?> 27 29 </select></td> 28 <td><select >30 <td><select name="<?cs name:item ?>_frequency"> 29 31 <?cs each:freq = sitemap.frequencies ?> 30 <option value="<?cs var:freq ?>" ><?cs var:freq ?></option>32 <option value="<?cs var:freq ?>" <?cs if:freq == item.frequency ?>selected="selected"<?cs /if ?>><?cs var:freq ?></option> 31 33 <?cs /each ?> 32 34 </select></td> 33 35 </tr> 34 <tr> 35 <td><input type="checkbox" name="tickets" value="1"/></td> 36 <td><strong>Tickets</strong></td> 37 <td><select> 38 <?cs each:priority = sitemap.priorities ?> 39 <option value="<?cs var:priority ?>"><?cs var:priority ?></option> 40 <?cs /each ?> 41 </select></td> 42 <td><select> 43 <?cs each:freq = sitemap.frequencies ?> 44 <option value="<?cs var:freq ?>"><?cs var:freq ?></option> 45 <?cs /each ?> 46 </select></td> 47 </tr> 36 <?cs /each ?> 48 37 </tbody> 49 38 <tfoot> 50 39 <tr> 51 <td colspan="4" style="font-size:80%;">A note on priorities and frequencies: The <strong>priority</strong> will determine 52 how search results will be ranked <em>within your site</em>. It will not influence 53 your Google PageRank™. The priority defaults to 0.5, you can set higher or 54 lower values to distinguish more or less important parts of your site. 40 <td colspan="4" style="font-size:80%;">Note: The <strong>priority</strong> will determine 41 how search results will be ranked <em>within your site</em>, bigger numbers indicating more important parts of your site. 42 It will not influence your Google PageRank™. 55 43 <p>The <strong>frequency</strong> indicates how often you plan to update 56 44 your site content with respect to this ressource. Setting it to <em>daily</em> doesn't neccessarily mean that Google will pick 57 up your page daily, it's just an indicator.</p></td> 45 up your page daily, it's just an indicator. Even pages marked as <em>never changing</em> (i.e. archives) are visited by the Google crawler 46 every once in a while to detect changes in the page itself.</p></td> 58 47 </tr> 59 48 </tfoot> 60 49 </table> 61 <fieldset>62 <legend>Notification</legend>63 <div class="field">64 <input id="cbPingGoogle" type="checkbox" name="pinggoogle" value="1" style="float:left"/>65 <label for="cbPingGoogle" style="display:block; margin-left: 50px;">66 Do you want to ping the Google Sitemap service each time a wiki67 page is created, updated or deleted?68 </label>69 </div>70 </fieldset>71 50 <div class="buttons"> 72 <input type="submit" value="Save">73 <input type="submit" value="Save & pingnow">51 <input type="submit" name="save" value="Save"> 52 <input type="submit" name="saveping" value="Save & notify now"> 74 53 </div> 75 54 </form>
Note: See TracChangeset
for help on using the changeset viewer.
