Changeset 953
- Timestamp:
- 03/19/07 23:57:48 (20 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 modified
-
Build.PL (modified) (2 diffs)
-
Changes (modified) (1 diff)
-
INSTALL (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
README.GMAPS (modified) (1 diff)
-
lib/OpenGuides.pm (modified) (1 diff)
-
lib/OpenGuides/CGI.pm (modified) (1 diff)
-
lib/OpenGuides/Config.pm (modified) (4 diffs)
-
t/13_cookies.t (modified) (3 diffs)
-
t/46_map_in_node_display.t (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Build.PL
r951 r953 41 41 qw(use_plucene enable_page_deletion navbar_on_home_page backlinks_in_title 42 42 moderation_requires_password enable_node_image enable_common_categories 43 enable_common_locales recent_changes_on_home_page); 43 enable_common_locales recent_changes_on_home_page 44 show_gmap_in_node_display); 44 45 45 46 my $skip_config = Module::Build->y_n("Skip OpenGuides configuration?", "n"); … … 98 99 site_desc default_city default_country contact_email default_language 99 100 formatting_rules_node backlinks_in_title gmaps_api_key centre_long 100 centre_lat default_gmaps_zoom default_gmaps_search_zoom force_wgs84 101 centre_lat show_gmap_in_node_display default_gmaps_zoom 102 default_gmaps_search_zoom force_wgs84 101 103 licence_name licence_url licence_info_url moderation_requires_password 102 104 enable_node_image enable_common_categories enable_common_locales -
trunk/Changes
r951 r953 17 17 to make it easier for people to change the order in a custom template 18 18 Move common categories/locales into navbar. 19 Add config option to suppress inline maps on geotagged nodes. 20 Fix preferences to take notice of users turning off inline Google maps. 19 21 Write tests for and fix: 20 22 #48 (Edit conflict page erroneously converts lat/lon to os_x, os_y). -
trunk/INSTALL
r941 r953 220 220 The defaults are probably appropriate in most cases. 221 221 222 "Would you like to display a Google Map on every node that has geodata?" 223 224 Answer "y" or "n". Note that an answer of "y" will only take effect if you've 225 supplied a Google Maps API key above. Note further that users can choose to 226 turn this off in their preferences. 227 222 228 "Forcibly treat stored lat/long data as if they used the WGS84 ellipsoid?" 223 229 -
trunk/MANIFEST
r951 r953 106 106 t/44_node_image.t 107 107 t/45_home_recent_changes.t 108 t/46_map_in_node_display.t 108 109 t/51_display_node.t 109 110 t/52_display_diffs.t -
trunk/README.GMAPS
r736 r953 6 6 http://www.google.com/apis/maps/signup.html. When you've put this value into 7 7 the config file as gmaps_api_key, the maps become available to you in two 8 places. Firstly, if the user has set the user preference to display Google 9 Maps, any node which has location information will get an inset map 10 pinpointing the location. Secondly, the URL 8 places. Firstly, if you've set "show_gmap_in_node_display", and if the user 9 has set their preferences to display Google Maps, any node which has 10 location information will get an inset map pinpointing the location. 11 Secondly, the URL 11 12 http://.../wiki.cgi?action=index;format=map becomes a large map with a list 12 13 of all nodes (regardless of the user settings). The latter will become very -
trunk/lib/OpenGuides.pm
r941 r953 240 240 oldid => $oldid, 241 241 enable_gmaps => 1, 242 display_google_maps => $self->get_cookie("display_google_maps"),243 242 wgs84_long => $wgs84_long, 244 243 wgs84_lat => $wgs84_lat 245 244 ); 245 246 if ( $config->show_gmap_in_node_display 247 && $self->get_cookie( "display_google_maps" ) ) { 248 $tt_vars{display_google_maps} = 1; 249 } 246 250 247 251 # Should we include a standard list of categories or locales? -
trunk/lib/OpenGuides/CGI.pm
r888 r953 156 156 %data = $cookies{$cookie_name}->value; # call ->value in list context 157 157 } 158 return ( username => $data{user} || "Anonymous", 159 include_geocache_link => $data{gclink} || 0, 160 preview_above_edit_box => $data{prevab} || 0, 161 latlong_traditional => $data{lltrad} || 0, 162 omit_help_links => $data{omithlplks} || 0, 163 show_minor_edits_in_rc => $data{rcmined} || 0, 164 default_edit_type => $data{defedit} || "normal", 165 cookie_expires => $data{exp} || "month", 166 track_recent_changes_views => $data{trackrc} || 0, 167 display_google_maps => $data{gmaps} || 1 168 ); 158 my %defaults = ( 159 username => "Anonymous", 160 include_geocache_link => 0, 161 preview_above_edit_box => 0, 162 latlong_traditional => 0, 163 omit_help_links => 0, 164 show_minor_edits_in_rc => 0, 165 default_edit_type => "normal", 166 cookie_expires => "month", 167 track_recent_changes_views => 0, 168 display_google_maps => 1, 169 ); 170 my %long_forms = ( 171 user => "username", 172 gclink => "include_geocache_link", 173 prevab => "preview_above_edit_box", 174 lltrad => "latlong_traditional", 175 omithlplks => "omit_help_links", 176 rcmined => "show_minor_edits_in_rc", 177 defedit => "default_edit_type", 178 exp => "cookie_expires", 179 trackrc => "track_recent_changes_views", 180 gmaps => "display_google_maps", 181 ); 182 my %return; 183 foreach my $key ( keys %long_forms ) { 184 my $long_key = $long_forms{$key}; 185 if ( defined $data{$key} ) { 186 $return{$long_key} = $data{$key}; 187 } else { 188 $return{$long_key} = $defaults{$long_key}; 189 } 190 } 191 return %return; 169 192 } 170 193 -
trunk/lib/OpenGuides/Config.pm
r948 r953 17 17 formatting_rules_node formatting_rules_link backlinks_in_title template_path 18 18 custom_template_path geo_handler ellipsoid gmaps_api_key centre_long 19 show_gmap_in_node_display 19 20 centre_lat default_gmaps_zoom default_gmaps_search_zoom force_wgs84 20 21 licence_name licence_url licence_info_url moderation_requires_password … … 93 94 geo_handler => 1, 94 95 ellipsoid => "WGS-84", 96 show_gmap_in_node_display => 1, 95 97 centre_long => 0, 96 98 centre_lat => 0, … … 172 174 default_gmaps_zoom => "What default zoom level shall we use for Google Maps? (This question can be ignored if you aren't using Google Maps)", 173 175 default_gmaps_search_zoom => "What default zoom level shall we use for Google Maps in the search results? (This question can be ignored if you aren't using Google Maps)", 176 show_gmap_in_node_display => "Would you like to display a Google Map on every node that has geodata? (This question can be ignored if you aren't using Google Maps)", 174 177 force_wgs84 => "Forcibly treat stored lat/long data as if they used the WGS84 ellipsoid?", 175 178 licence_name => "What licence will you use for the guide?", … … 282 285 =item * default_gmaps_search_zoom 283 286 287 =item * show_gmap_in_node_display 288 284 289 =item * force_wgs84 285 290 -
trunk/t/13_cookies.t
r731 r953 4 4 use Time::Piece; 5 5 use Time::Seconds; 6 use Test::More tests => 2 0;6 use Test::More tests => 27; 7 7 8 8 eval { OpenGuides::CGI->make_prefs_cookie; }; … … 17 17 is( $@, "", "...but not if it is" ); 18 18 19 # Use nonsense values here to make sure the test is a good one regardless 20 # of defaults - can't do this for cookie_expires, unfortunately. 19 21 my $cookie = OpenGuides::CGI->make_prefs_cookie( 20 22 config => $config, 21 username => " Kake",22 include_geocache_link => 1,23 preview_above_edit_box => 1,24 latlong_traditional => 1,25 omit_help_links => 1,26 show_minor_edits_in_rc => 1,27 default_edit_type => " tidying",23 username => "un_pref", 24 include_geocache_link => "gc_pref", 25 preview_above_edit_box => "pv_pref", 26 latlong_traditional => "ll_pref", 27 omit_help_links => "hl_pref", 28 show_minor_edits_in_rc => "me_pref", 29 default_edit_type => "et_pref", 28 30 cookie_expires => "never", 29 track_recent_changes_views => 1,30 display_google_maps => 131 track_recent_changes_views => "rc_pref", 32 display_google_maps => "gm_pref", 31 33 ); 32 34 isa_ok( $cookie, "CGI::Cookie", "->make_prefs_cookie returns a cookie" ); … … 55 57 56 58 my %prefs = OpenGuides::CGI->get_prefs_from_cookie( config => $config ); 57 is( $prefs{username}, "Kake", 58 "get_prefs_from_cookie can find username" ); 59 is( $prefs{include_geocache_link}, 1, "...and geocache prefs" ); 60 is( $prefs{preview_above_edit_box}, 1, "...and preview prefs" ); 61 is( $prefs{latlong_traditional}, 1, "...and latlong prefs" ); 62 is( $prefs{omit_help_links}, 1, "...and help link prefs" ); 63 is( $prefs{show_minor_edits_in_rc}, 1, "...and minor edits prefs" ); 64 is( $prefs{default_edit_type}, "tidying", "...and default edit prefs" ); 59 is( $prefs{username}, "un_pref", "get_prefs_from_cookie can find username" ); 60 is( $prefs{include_geocache_link}, "gc_pref", "...and geocache prefs" ); 61 is( $prefs{preview_above_edit_box}, "pv_pref", "...and preview prefs" ); 62 is( $prefs{latlong_traditional}, "ll_pref", "...and latlong prefs" ); 63 is( $prefs{omit_help_links}, "hl_pref", "...and help link prefs" ); 64 is( $prefs{show_minor_edits_in_rc}, "me_pref", "...and minor edits prefs" ); 65 is( $prefs{default_edit_type}, "et_pref", "...and default edit prefs" ); 65 66 is( $prefs{cookie_expires}, "never", "...and requested cookie expiry" ); 66 ok( $prefs{track_recent_changes_views}, "...and recent changes tracking" ); 67 is( $prefs{display_google_maps}, 1, "...and Google Maps display preference" ); 67 is( $prefs{track_recent_changes_views}, "rc_pref", 68 "...and recent changes tracking" ); 69 is( $prefs{display_google_maps}, "gm_pref", 70 "...and Google Maps display preference" ); 71 72 # Now make sure that true/false preferences are taken account of when 73 # they're false. 74 $cookie = OpenGuides::CGI->make_prefs_cookie( 75 config => $config, 76 include_geocache_link => 0, 77 preview_above_edit_box => 0, 78 latlong_traditional => 0, 79 omit_help_links => 0, 80 show_minor_edits_in_rc => 0, 81 track_recent_changes_views => 0, 82 display_google_maps => 0, 83 ); 84 85 $ENV{HTTP_COOKIE} = $cookie; 86 87 %prefs = OpenGuides::CGI->get_prefs_from_cookie( config => $config ); 88 ok( !$prefs{include_geocache_link}, "geocache prefs taken note of when false"); 89 ok( !$prefs{preview_above_edit_box}, "...and preview prefs" ); 90 ok( !$prefs{latlong_traditional}, "...and latlong prefs" ); 91 ok( !$prefs{omit_help_links}, "...and help link prefs" ); 92 ok( !$prefs{show_minor_edits_in_rc}, "...and minor edits prefs" ); 93 ok( !$prefs{track_recent_changes_views}, "...and recent changes prefs" ); 94 ok( !$prefs{display_google_maps}, "...and Google Maps prefs" ); 68 95 69 96 # Check that cookie parsing fails nicely if no cookie set.
