Bar cleanups
This commit is contained in:
parent
30df796ed4
commit
ac2371bc15
@ -58,37 +58,30 @@ sub block_display {
|
|||||||
params => {});
|
params => {});
|
||||||
|
|
||||||
# Initialise fragments to sane "logged out" defaults.
|
# Initialise fragments to sane "logged out" defaults.
|
||||||
my ($import, $userprofile, $docs) =
|
my ($userprofile) =
|
||||||
($self -> {"template"} -> load_template("userbar/import_disabled.tem"),
|
($self -> {"template"} -> load_template("userbar/profile_loggedout_http".($ENV{"HTTPS"} eq "on" ? "s" : "").".tem", {"%(url-login)s" => $loginurl}),
|
||||||
$self -> {"template"} -> load_template("userbar/profile_loggedout_http".($ENV{"HTTPS"} eq "on" ? "s" : "").".tem", {"***url-login***" => $loginurl}),
|
|
||||||
$self -> {"template"} -> load_template("userbar/doclink_disabled.tem"),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
# Is documentation available?
|
|
||||||
my $url = $self -> get_documentation_url($doclink);
|
|
||||||
$docs = $self -> {"template"} -> load_template("userbar/doclink_enabled.tem", {"***url-doclink***" => $url})
|
|
||||||
if($url);
|
|
||||||
|
|
||||||
# Is the user logged in?
|
# Is the user logged in?
|
||||||
if(!$self -> {"session"} -> anonymous_session()) {
|
if(!$self -> {"session"} -> anonymous_session()) {
|
||||||
my $user = $self -> {"session"} -> get_user_byid()
|
my $user = $self -> {"session"} -> get_user_byid()
|
||||||
or return $self -> self_error("Unable to obtain user data for logged in user. This should not happen!");
|
or return $self -> self_error("Unable to obtain user data for logged in user. This should not happen!");
|
||||||
|
|
||||||
$import = $self -> {"template"} -> load_template("userbar/import_enabled.tem" , {"***url-import***" => $self -> build_url(block => "import", pathinfo => [])})
|
$import = $self -> {"template"} -> load_template("userbar/import_enabled.tem" , {"%(url-import)s" => $self -> build_url(block => "import", pathinfo => [])})
|
||||||
if($self -> check_permission("import") && $current ne "import");
|
if($self -> check_permission("import") && $current ne "import");
|
||||||
|
|
||||||
# User is logged in, so actually reflect their current options and state
|
# User is logged in, so actually reflect their current options and state
|
||||||
$userprofile = $self -> {"template"} -> load_template("userbar/profile_loggedin.tem", {"***realname***" => $user -> {"fullname"},
|
$userprofile = $self -> {"template"} -> load_template("userbar/profile_loggedin.tem", {"%(realname)s" => $user -> {"fullname"},
|
||||||
"***username***" => $user -> {"username"},
|
"%(username)s" => $user -> {"username"},
|
||||||
"***gravhash***" => $user -> {"gravatar_hash"},
|
"%(gravhash)s" => $user -> {"gravatar_hash"},
|
||||||
"***url-logout***" => $self -> build_url(block => "login" , pathinfo => ["logout"])});
|
"%(url-logout)s" => $self -> build_url(block => "login" , pathinfo => ["logout"])});
|
||||||
} # if(!$self -> {"session"} -> anonymous_session())
|
} # if(!$self -> {"session"} -> anonymous_session())
|
||||||
|
|
||||||
return $self -> {"template"} -> load_template("userbar/userbar.tem", {"***pagename***" => $title,
|
return $self -> {"template"} -> load_template("userbar/userbar.tem", {"%(pagename)s" => $title,
|
||||||
"***front_url***" => $fronturl,
|
"%(front_url)s" => $fronturl,
|
||||||
"***import***" => $import,
|
"%(import)s" => $import,
|
||||||
"***doclink***" => $docs,
|
"%(doclink)s" => $docs,
|
||||||
"***profile***" => $userprofile});
|
"%(profile)s" => $userprofile});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user