Browse Source

don't display wala stuff without a root dir

pull/1/head
Brennen Bearnes 11 years ago
parent
commit
e36be446c8
3 changed files with 34 additions and 6 deletions
  1. +11
    -5
      lib/Display.pm
  2. +17
    -0
      lib/Wala.pm
  3. +6
    -1
      templates/p1k3_actual

+ 11
- 5
lib/Display.pm View File

@ -810,17 +810,23 @@ sub datestamp {
my ($entry_year, $entry_month, $entry_day) = split m{/}, $1;
# this stuff conditionalizes the wikilink
# This stuff conditionalizes the wikilink
# so that if nothing exists, you wind up with an edit form
my ($wiki_date_name) = month_name($entry_month)
. "_${entry_day}_${entry_year}";
my $wikistamp = ':: ';
my $wikistamp;
my $wikititle;
if ($self->wala->is_page($wiki_date_name)) {
# If we have a Wala available, see about a margins (comment) section
if ($self->wala->is_this_thing_on()) {
$wikistamp = ':: ';
if ($self->wala->is_page($wiki_date_name)) {
$wikititle = 'read the margins';
} else { $wikititle = 'write in the margins'; }
} else {
$wikititle = 'write in the margins';
}
}
$wikistamp .= a({ href => $self->wala->ScriptName . "?$wiki_date_name",
title => 'a page you can edit'
@ -828,7 +834,7 @@ sub datestamp {
$wikititle);
if ( -e $self->local_path($entry . "/NoMargin") ) {
$wikistamp = "<!-- Margin blocked. -->";
$wikistamp = "<!-- Margin blocked. -->";
}
# Return a fancy datestamp:


+ 17
- 0
lib/Wala.pm View File

@ -86,6 +86,23 @@ sub new {
return $self;
}
=item is_this_thing_on()
Check and see if we even have anywhere to find pages.
=cut
{
my $on;
sub is_this_thing_on {
my $self = shift;
if (! defined $on) {
$on = -d $self->RootDir;
}
return $on;
}
}
=item run()
=cut


+ 6
- 1
templates/p1k3_actual View File

@ -74,7 +74,12 @@ HTML
);
my $shorthand = join '|', keys %translation;
my $LinkDump = $self->wala->print_page('LinkDump');
my $LinkDump;
if ($self->wala->is_this_thing_on()) {
$LinkDump = $self->wala->print_page('LinkDump');
} else {
$LinkDump = '';
}
$LinkDump =~ s{<p>($shorthand):}
{<p><img src="/imgs/favicons/$1.png" height=16 width=16 title="$translation{$1}" style="vertical-align: middle;" />}sg;


|||||||
x
 
000:0
Loading…
Cancel
Save