help supports inheritance
This commit is contained in:
parent
0673df503d
commit
ab4caf1342
6 changed files with 50 additions and 15 deletions
|
|
@ -20,6 +20,9 @@
|
|||
- Added a wiki-like feature that will automatically bring a user to the
|
||||
create a page form if they are in admin mode, and click on a link to
|
||||
a page that doesn't exist yet.
|
||||
- Help is now capable of using inheritance.
|
||||
- Template help can/should now be broken out as seperate fields going
|
||||
forward.
|
||||
- Many changes for better XHTML compliance.
|
||||
- Refactored admin bar to be more dynamic.
|
||||
- Removed start/end dates from assets in favor of the workflow system.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<tmpl_loop fields>
|
||||
<dt><tmpl_var title></dt>
|
||||
<dd><tmpl_var description>
|
||||
<tmpl_if uiLevel> <br /><i><tmpl_var uiLevelLabel>:</i><tmpl_var uiLevel> </tmpl_if>
|
||||
<tmpl_if uiLevel> <br /><i><tmpl_var uiLevelLabel>:</i><tmpl_var uiLevel><br /> </tmpl_if>
|
||||
</dd>
|
||||
</tmpl_loop>
|
||||
</dl>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
~~~
|
||||
<style type="text/css">
|
||||
dt {
|
||||
dd {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ our $HELP = {
|
|||
'folder add/edit' => {
|
||||
title => 'folder add/edit title',
|
||||
body => 'folder add/edit body',
|
||||
isa => {
|
||||
namespace => "Asset_Wobject",
|
||||
tag => "wobject add/edit"
|
||||
},
|
||||
fields => [
|
||||
{
|
||||
title => 'visitor cache timeout',
|
||||
|
|
@ -19,14 +23,6 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
related => [
|
||||
{
|
||||
tag => 'asset fields',
|
||||
namespace => 'Asset',
|
||||
},
|
||||
{
|
||||
tag => 'wobject add/edit',
|
||||
namespace => 'Asset_Wobject',
|
||||
},
|
||||
{
|
||||
tag => 'folder template',
|
||||
namespace => 'Asset_Folder',
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ our $HELP = {
|
|||
'wobject add/edit' => {
|
||||
title => '677',
|
||||
body => '632',
|
||||
isa => {
|
||||
tag => 'asset fields',
|
||||
namespace => 'Asset'
|
||||
},
|
||||
fields => [
|
||||
{
|
||||
title => '174',
|
||||
|
|
@ -54,10 +58,6 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
related => [
|
||||
{
|
||||
tag => 'asset fields',
|
||||
namespace => 'Asset'
|
||||
},
|
||||
{
|
||||
tag => 'wobjects using',
|
||||
namespace => 'Asset_Wobject'
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@ our $HELP = { ##hashref of hashes
|
|||
|
||||
title => 'help article title', #The title and body are looked up in the
|
||||
body => 'help article title', #i18n file of the same name
|
||||
# use the following to inherit stuff from another help entry
|
||||
isa => {
|
||||
tag => 'some other help tag',
|
||||
namespace => 'some other help file',
|
||||
},
|
||||
fields => [ #This array is used to list hover help for form fields.
|
||||
{
|
||||
title => 'form label 1',
|
||||
|
|
@ -22,6 +27,12 @@ our $HELP = { ##hashref of hashes
|
|||
namespace => 'namespace', #The namespace is called out explicitly
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => "template.variable.name",
|
||||
description => "international tag in this namespace describing this var"
|
||||
},
|
||||
],
|
||||
related => [ ##This lists other help articles that are related to this one
|
||||
{
|
||||
tag => 'other help article',
|
||||
|
|
|
|||
|
|
@ -46,6 +46,23 @@ sub _load {
|
|||
my $load = sprintf 'use %-s; $%-s::HELP;', $cmd, $cmd;
|
||||
my $hash = eval($load);
|
||||
unless ($@) {
|
||||
foreach my $tag (keys %{$hash}) {
|
||||
if ($hash->{$tag}{isa}{namespace}) {
|
||||
my $other = _load($session, $hash->{$tag}{isa}{namespace});
|
||||
my $add = $other->{$hash->{$tag}{isa}{tag}}{fields};
|
||||
@{$hash->{$tag}{fields}} = (@{$hash->{$tag}{fields}}, @{$add});
|
||||
my $add = $other->{$hash->{$tag}{isa}{tag}}{related};
|
||||
@{$hash->{$tag}{related}} = (@{$hash->{$tag}{related}}, @{$add});
|
||||
my $add = $other->{$hash->{$tag}{isa}{tag}}{variables};
|
||||
foreach my $row (@{$add}) {
|
||||
push(@{$hash->{$tag}{variables}}, {
|
||||
name=> $row->{name},
|
||||
description => $row->{description},
|
||||
namespace => $row->{namespace} || $hash->{$tag}{isa}{namespace}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return $hash
|
||||
}
|
||||
else {
|
||||
|
|
@ -260,6 +277,14 @@ sub www_viewHelp {
|
|||
);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _getTemplateVars ( )
|
||||
|
||||
Generates help template vars for a template help file.
|
||||
|
||||
=cut
|
||||
|
||||
sub _getTemplateVars {
|
||||
my $session = shift;
|
||||
my $level = shift;
|
||||
|
|
@ -276,7 +301,7 @@ sub _getTemplateVars {
|
|||
}
|
||||
push ( @{$template}, {
|
||||
title => $row->{name},
|
||||
description=> $i18n->get($row->{description} || $row->{name}),
|
||||
description=> $i18n->get($row->{description} || $row->{name}, $row->{namespace}),
|
||||
$label => $indent
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue