Changeset 30


Ignore:
Timestamp:
02/24/07 08:47:18 (5 years ago)
Author:
christian
Message:

Created a eclipse test environment, containing a trac env as well. Username for that is "admin" with password "admin". Please note that the python run path is hardcoded since pydev doesn't allow variable expansion yet.

Location:
sitemap-plugin/trunk
Files:
28 added
8 edited

Legend:

Unmodified
Added
Removed
  • sitemap-plugin/trunk/.project

    • Property svn:mime-type set to text/xml
  • sitemap-plugin/trunk/.pydevproject

    • Property svn:mime-type set to text/xml
    r29 r30  
    77<path>/Sitemap-Plugin/src</path> 
    88</pydev_pathproperty> 
     9<pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH"> 
     10<path/> 
     11</pydev_pathproperty> 
    912</pydev_project> 
  • sitemap-plugin/trunk/src/setup.py

    r29 r30  
    11#!/usr/bin/env python 
    22 
    3 from setuptools import setup 
     3from setuptools import setup #@UnresolvedImport 
    44 
    55PACKAGE = 'sitemap' 
  • sitemap-plugin/trunk/src/sitemap/__init__.py

    r18 r30  
    11import api 
    22import wiki 
     3import ticket 
    34try: 
    45    from admin_ui import * 
  • sitemap-plugin/trunk/src/sitemap/admin_ui.py

    r18 r30  
    11from pkg_resources import resource_filename #@UnresolvedImport 
    2 from webadmin.web_ui import IAdminPageProvider 
     2from webadmin.web_ui import IAdminPageProvider #@UnresolvedImport 
    33from trac.web.chrome import ITemplateProvider 
    44from trac.core import implements 
     
    3232 
    3333        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  
     34            if page == 'sitemap_admin': 
     35                if ('save' in req.args) | ('saveping' in req.args): 
     36                   self.env.log.debug('Saving new values') 
     37                   self.env.config.set('sitemap', 'confirmationpage', req.args['confirmationpage']) 
     38                   self.env.config.set('sitemap', 'base_url', req.args['base_url']) 
     39                   for contributor in c.contributors: 
     40                        contributor.set_configuration(req) 
     41                   self.env.config.save() 
     42                if 'saveping' in req.args: 
     43                   c.send_ping() 
     44                    
     45        req.hdf['sitemap.confirmationpage'] = c.confirmationpage 
     46        req.hdf['sitemap.base_url'] = c.base_url 
     47        req.hdf['sitemap.base_url_trac'] = self.env.base_url 
    4348        req.hdf['sitemap.data'] = c.get_descriptions() 
    44         req.hdf['sitemap.url'] = c.path 
     49        req.hdf['sitemap.path'] = c.path 
    4550        req.hdf['sitemap.priorities'] = self.priorities 
    4651        req.hdf['sitemap.frequencies'] = self.frequencies 
  • sitemap-plugin/trunk/src/sitemap/api.py

    r28 r30  
    55from xml.sax.saxutils import escape 
    66from trac.web.api import IRequestHandler 
     7from trac.web.href import Href 
    78from trac.config import Option 
    89from trac.core import implements 
     
    6162        """ 
    6263         
    63     def set_configuration(self, priority, frequency): 
     64    def set_configuration(self, req): 
    6465        """Update config to new values""" 
    6566     
     
    7778 
    7879    contributors = ExtensionPoint(ISitemapContributor) 
     80     
     81    base_url = Option('sitemap', 'base_url', '', 
     82       """Base URL (protocol, host, port) of your trac installation, as Google should use it""") 
    7983     
    8084    confirmationpage = Option('sitemap', 'confirmationpage', '', 
     
    150154    def send_ping(self): 
    151155        """Ping Google sitemaps to indicate that an updated sitemap is available""" 
     156        href = Href(self.env.abs_href) 
    152157        url = 'http://www.google.com/webmasters/sitemaps/ping?' + \ 
    153               urlencode({'sitemap' : self.env.abs_href(self.path)}) 
     158              urlencode({'sitemap' : href}) 
     159        self.env.log.info('Sending ping to Google: %s ' % url) 
    154160        urllib2.urlopen(url) 
    155         self.env.log.info('Sent ping to google: %s ' % url) 
    156          
     161          
  • sitemap-plugin/trunk/src/sitemap/templates/sitemap_admin.cs

    r18 r30  
    11<form class="mod" method="post"> 
    22<h2>Google Sitemap&trade; settings</h2> 
    3 <p>What ressources should be included in your sitemap located at <strong><?cs var:sitemap.url ?></strong>?</p> 
     3  <div class="field"> 
     4   <label>Google page name:<br /> 
     5    <input size="30" type="text" name="confirmationpage" value="<?cs var:sitemap.confirmationpage ?>" /> e.g. <em>googleeb3689b3689b3689.html</em> 
     6   </label> 
     7  </div> 
     8  <div class="field"> 
     9   <label>Base url:<br /> 
     10    <input size="60" type="text" name="base_url" value="<?cs var:sitemap.base_url ?>" style="width:100%" /> 
     11   </label> 
     12  </div> 
     13<p>What ressources should be included in your sitemap located at <strong><?cs var:sitemap.path ?></strong>?</p> 
    414<table class="listing" id="sitemaplist" style="width:100%;margin-bottom:2em;"> 
    515        <colgroup> 
  • sitemap-plugin/trunk/src/sitemap/wiki.py

    r19 r30  
    4545        } 
    4646         
    47     def set_configuration(self, priority, frequency): 
     47    def set_configuration(self, req): 
    4848        """Update config to new values""" 
    4949         
     
    5454        wiki = WikiSystem(self.env) 
    5555        d = [] 
    56         href = Href(req.base_url) 
     56        href = Href(self.env.base_url) 
    5757        for pagename in wiki.get_pages(): 
    5858            page = WikiPage(self.env, pagename) 
     
    6464            entry_time = datetime.datetime.utcfromtimestamp(post_time) 
    6565            d.append(RessourceData( 
    66                                   href(req.href.wiki(pagename)), 
     66                                  href.wiki(pagename), 
    6767                                  entry_time.strftime("%Y-%m-%dT%H:%M:%SZ"), 
    6868                                  self.frequency, 
Note: See TracChangeset for help on using the changeset viewer.