Changeset 607


Ignore:
Timestamp:
Jan 2, 2005, 2:06:44 AM (17 years ago)
Author:
Dominic Hargreaves
Message:

Allow configuration of external text formatting link

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r606 r607  
    33        Now require CGI::Wiki 0.62 to fix bug with deleting versions.
    44        Try to ensure that a .htaccess file protecting wiki.conf is installed.
     5        Allow for external URLs for Text Formatting help.
    56
    670.46    21 December 2004
  • trunk/lib/OpenGuides/Config.pm

    r606 r607  
    1010   admin_pass stylesheet_url site_name navbar_on_home_page home_name
    1111   site_desc default_city default_country contact_email default_language
    12    formatting_rules_node backlinks_in_title template_path custom_template_path
     12   formatting_rules_node formatting_rules_link backlinks_in_title template_path custom_template_path
    1313   geo_handler ellipsoid
    1414);
     
    7373                     default_language => "en",
    7474                     formatting_rules_node => "Text Formatting Examples",
     75                     formatting_rules_link => "http://openguides.org/page/text_formatting",
    7576                     backlinks_in_title => 0,
    7677                     geo_handler => 1,
     
    127128        contact_email => "Contact email address for the site administrator?",
    128129        default_language => "What language will the site be in? (Please give an ISO language code.)",
    129         formatting_rules_node => "What's the name of the node to use for the text formatting rules link?",
     130        formatting_rules_node => "What's the name of the node or page to use for the text formatting rules link (this is by default an external document, but if you make formatting_rules_link empty, it will be a wiki node instead",
     131        formatting_rules_link => "What URL do you want to use for the text formatting rules (leave blank to use a wiki node instead)?",
    130132        backlinks_in_title => "Make node titles link to node backlinks (C2 style)?",
    131133        ellipsoid => "Which ellipsoid do you want to use? (eg 'Airy', 'WGS-84')",
     
    210212=item * formatting_rules_node (default: C<Text Formatting Examples>)
    211213
     214=item * formatting_rules_link (default: C<http://openguides.org/page/text_formatting>
     215
    212216=item * backlinks_in_title (default: false)
    213217
  • trunk/lib/OpenGuides/Template.pm

    r606 r607  
    117117    # Check cookie to see if we need to set the formatting_rules_link.
    118118    my ($formatting_rules_link, $omit_help_links);
    119     my $formatting_rules_node = $config->formatting_rules_node ||"";
     119    my $formatting_rules_node = $config->formatting_rules_node;
     120    $formatting_rules_link = $config->formatting_rules_link;
    120121    my %cookie_data = OpenGuides::CGI->get_prefs_from_cookie(config=>$config);
    121122    if ( $cookie_data{omit_help_links} ) {
    122123        $omit_help_links = 1;
    123124    } else {
    124         if ( $formatting_rules_node ) {
     125        if (( $formatting_rules_node ) and !( $formatting_rules_link )){
    125126            $formatting_rules_link = $script_url . $script_name . "?"
    126127                                   . uri_escape($args{wiki}->formatter->node_name_to_node_param($formatting_rules_node));
  • trunk/t/15_template.t

    r606 r607  
    66use OpenGuides::Template;
    77use Test::MockObject;
    8 use Test::More tests => 27;
     8use Test::More tests => 28;
    99
    1010my $config = OpenGuides::Config->new(
     
    2020                 home_name             => 'Home Page',
    2121                 formatting_rules_node => 'Rules',
     22                 formatting_rules_link => '',
    2223               }
    2324);
     
    112113like( $output, qr/Set-Cookie: $cookie/, "cookie in header" );
    113114
     115# Test that external URLs for text formatting work.
     116$config = OpenGuides::Config->new(
     117       vars => {
     118                 template_path         => cwd . '/t/templates',
     119                 site_name             => 'CGI::Wiki Test Site',
     120                 script_url            => 'http://wiki.example.com/',
     121                 script_name           => 'mywiki.cgi',
     122                 formatting_rules_node => 'Some External Help',
     123                 formatting_rules_link => 'http://www.example.com/wikitext',
     124               }
     125);
     126$output = OpenGuides::Template->output(
     127    wiki     => $fake_wiki,
     128    config   => $config,
     129    template => "15_test.tt"
     130);
     131like ( $output, qr/FORMATTING RULES LINK: http:\/\/www.example.com\/wikitext/,
     132      "formatting_rules_link var honoured for explicit URLs" );
     133
    114134# Test that home_link is set correctly when script_name is blank.
    115135$config = OpenGuides::Config->new(
Note: See TracChangeset for help on using the changeset viewer.