Changeset 1088

Show
Ignore:
Timestamp:
06/17/07 16:13:47 (1 year ago)
Author:
dom
Message:

Add support for installing static files (fixes #213)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Build.PL

    r1058 r1088  
    105105   licence_name licence_url licence_info_url moderation_requires_password 
    106106   enable_node_image enable_common_categories enable_common_locales 
    107    spam_detector_module 
     107   spam_detector_module static_path static_url 
    108108  ) ) { 
    109109    my $q_method = $var . "__qu"; 
     
    376376    ] ); 
    377377 
     378$build->config_data( __static_files => [ 
     379    # XXX to be supplied when we have some 
     380    ] ); 
     381 
    378382# Finally write the build script. 
    379383$build->create_build_script; 
  • trunk/INSTALL

    r1037 r1088  
    284284to the question of whether the edit should be considered to be spam.  
    285285 
     286  "What directory should we install static content (CSS, images, javascript) 
     287   to?" 
     288 
     289OpenGuides comes with some static content which will be installed 
     290automatically. 
     291 
     292  "What is the URL corresponding to the static content?" 
     293 
     294You will need to configure the above directory in your web server, then 
     295input the URL the content will be visible at here. 
     296 
    286297  "Distance calculation methods available are: 
    287298      1) British National Grid 
     
    331342provide site-specific design. These templates are stored in the directory 
    332343custom-templates/ by default and are described in the file CUSTOMISATION. 
     344 
    333345The id and class tags used for the CSS in OpenGuides are specified in 
    334346README.CSS. 
  • trunk/lib/OpenGuides/Build.pm

    r1028 r1088  
    6060    my $custom_template_path = $config->custom_template_path; 
    6161    my $custom_lib_path      = $config->custom_lib_path; 
     62    my $static_path          = $config->static_path; 
    6263    my @extra_scripts        = @{ $self->config_data( "__extra_scripts" ) }; 
    6364    my @templates            = @{ $self->config_data( "__templates" ) }; 
     65    my @static_files         = @{ $self->config_data( "__static_files" ) }; 
    6466 
    6567    print "Installing scripts to $install_directory:\n"; 
     
    140142        if ( $FAKE ) { 
    141143            print "templates/$template -> $template_path/$template (FAKE)\n"; 
    142         } else { 
    143             $self->copy_if_modified(from => "templates/$template", to_dir => $template_path, flatten => 1) 
     144            } else { 
     145                $self->copy_if_modified(from => "templates/$template", to_dir => $template_path, flatten => 1) 
    144146                or print "Skipping $template_path/$template (unchanged)\n"; 
    145147        } 
     
    151153            print "Creating directory $custom_template_path.\n"; 
    152154            mkdir $custom_template_path or warn "Could not make $custom_template_path"; 
     155        } 
     156    } 
     157 
     158    print "Installing static files to $static_path:\n"; 
     159    foreach my $static_file ( @static_files ) { 
     160        if ( $FAKE ) { 
     161            print "static/$static_file -> $static_path/$static_file (FAKE)\n"; 
     162        } else { 
     163            $self->copy_if_modified(from => "static/$static_file", to_dir => $static_path, flatten => 1) 
     164                or print "Skipping $static_path/$static_file (unchanged)\n"; 
    153165        } 
    154166    } 
  • trunk/lib/OpenGuides/Config.pm

    r1037 r1088  
    2222   licence_name licence_url licence_info_url moderation_requires_password 
    2323   enable_node_image enable_common_categories enable_common_locales 
    24    spam_detector_module 
     24   spam_detector_module static_path static_url 
    2525); 
    2626my @questions = map { $_ . "__qu" } @variables; 
     
    109109                     licence_info_url => "", 
    110110                     spam_detector_module => "", 
     111                     static_path => "/usr/local/share/openguides/static", 
    111112                   ); 
    112113 
     
    190191        licence_info_url => "What is the URL to your local page about your licensing policy?", 
    191192        spam_detector_module => "What module would you like to use for spam detection? (optional)", 
     193        static_path => "What directory should we install static content (CSS, images, javascript) to?", 
     194        static_url => "What is the URL corresponding to the static content?", 
    192195    ); 
    193196 
     
    316319=item * spam_detector_module 
    317320 
     321=item * static_path 
     322 
     323=item * static_url 
     324 
    318325=back 
    319326