• OpenPlans SVN

  • opencore r18815 - opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser

    from darcy on Jul 01, 2008 08:24 PM
    Author: egj
    Date: 2008-07-01 20:24:50 -0400 (Tue, 01 Jul 2008)
    New Revision: 18815
    
    Modified:
       opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/profile_edit_viewlet.pt
       opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/project_edit_viewlet.pt
       opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/viewlets.py
    Log:
    use 'geolocation' form field, which is not saved
    
    Modified: opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/profile_edit_viewlet.pt
    ===================================================================
    --- opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/profile_edit_viewlet.pt	2008-07-02 00:20:10 UTC (rev 18814)
    +++ opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/profile_edit_viewlet.pt	2008-07-02 00:24:50 UTC (rev 18815)
    @@ -1,6 +1,7 @@
     <label i18n:translate="profile-edit_location_label" for="location">Location</label> (example: "New York, NY" or "cloud nine")
     <br />
    -<input type="text" id="location" name="location" class="oc-autoFocus"
    +
    +<input type="text" id="geolocation" name="geolocation" class="oc-autoFocus"
         tal:attributes="value request/location | view/geo_info/location;
                         class python:request.form.get('field') == 'location' and default or nothing" />
     <span class="oc-js-unhide">
    
    Modified: opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/project_edit_viewlet.pt
    ===================================================================
    --- opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/project_edit_viewlet.pt	2008-07-02 00:20:10 UTC (rev 18814)
    +++ opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/project_edit_viewlet.pt	2008-07-02 00:24:50 UTC (rev 18815)
    @@ -7,11 +7,11 @@
                     <tr class="oc-form-row">
     
                       <th id="position-header" class="oc-form-label" scope="row">
    -                    <label for="location" i18n:translate="project-edit_address_label">
    +                    <label for="geolocation" i18n:translate="project-edit_address_label">
                          Location:</label>
                       </th>
                       <td id="position-input" class="oc-form-value oc-form-fieldBlock">
    -                    <input type="text" id="location" name="location"
    +                    <input type="text" id="geolocation" name="geolocation"
                                tal:attributes="value request/location | view/geo_info/location | nothing" />  (XXX do we want to say something about what we'll use this for? eg. for privacy concerns?)
                         <span class="oc-js-unhide">
                            <input type="button" value="Update Map" id="oc-map-update-button" />
    
    Modified: opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/viewlets.py
    ===================================================================
    --- opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/viewlets.py	2008-07-02 00:20:10 UTC (rev 18814)
    +++ opencore/plugins/oc-geotagging/trunk/opencore/geotagging/browser/viewlets.py	2008-07-02 00:24:50 UTC (rev 18815)
    @@ -41,7 +41,7 @@
                     'is_geocoded': self.is_geocoded(),
                     }
             content = self._get_viewedcontent()
    -        info['location'] = content and content.getLocation() or ''
    +        info['location'] = ''
             coords = self.get_geolocation()
             try:
                 lon, lat = coords[:2]
    @@ -88,6 +88,7 @@
     
         def save(self):
             """Save form data, if changed."""
    +
             view = self.__parent__
             # XXX we've already geocoded in validate(), don't hit google twice!
             geo_info, changes = self.get_geo_info_from_form()
    @@ -115,6 +116,7 @@
             This is kind of gunky, but was the most expedient way to
             integrate with our existing forms.
             """
    +
             view = self.__parent__
             geo_info, changed = self.get_geo_info_from_form()
             errors = geo_info.get('errors', {})
    @@ -137,7 +139,8 @@
             """See IWriteGeo.
             """
             if form is None:
    -            form = self.request.form
    +            form = dict(self.request.form)
    +            form['location'] = form.get('geolocation')
             if old_info is None:
                 old_info = self.geo_info
             new_info, changed = utils.update_info_from_form(