Bare minimum working
This commit is contained in:
parent
8f4024a4b2
commit
5e77a948ad
2 changed files with 66 additions and 25 deletions
|
|
@ -11,6 +11,11 @@ has 'session' => (
|
||||||
required => 1,
|
required => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sub BUILDARGS {
|
||||||
|
my ( $class, $session, @args ) = @_;
|
||||||
|
return { session => $session, @args };
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub getAdminPluginTemplateVars {
|
sub getAdminPluginTemplateVars {
|
||||||
|
|
@ -28,44 +33,48 @@ sub getAdminPluginTemplateVars {
|
||||||
# If we have a class name, we've got a new WebGUI::Admin::Plugin
|
# If we have a class name, we've got a new WebGUI::Admin::Plugin
|
||||||
if ( $funcDef->{className} ) {
|
if ( $funcDef->{className} ) {
|
||||||
my $plugin = $funcDef->{className}->new( $session, $funcId, $funcDef );
|
my $plugin = $funcDef->{className}->new( $session, $funcId, $funcDef );
|
||||||
|
next unless $plugin->canUse;
|
||||||
$var = {
|
$var = {
|
||||||
title => $plugin->getTitle,
|
title => $plugin->getTitle,
|
||||||
icon => $plugin->getIcon,
|
icon => $plugin->getIcon,
|
||||||
'icon.small' => $plugin->getIconSmall,
|
'icon.small' => $plugin->getIconSmall,
|
||||||
url => $plugin->getUrl,
|
url => $plugin->getUrl,
|
||||||
canUse => $plugin->canUse,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# build the list of processed items
|
||||||
|
$processed{$plugin->getTitle} = $var;
|
||||||
}
|
}
|
||||||
# Don't know what we have (old admin console functions)
|
# Don't know what we have (old admin console functions)
|
||||||
else {
|
else {
|
||||||
# make title
|
# make title
|
||||||
my $title = $functions->{$function}{title};
|
my $title = $funcDef->{title};
|
||||||
WebGUI::Macro::process( $session, \$title );
|
WebGUI::Macro::process( $session, \$title );
|
||||||
|
|
||||||
# determine if the user can use this thing
|
# determine if the user can use this thing
|
||||||
my $canUse = 0;
|
my $canUse = 0;
|
||||||
if ( defined $functions->{$function}{group} ) {
|
if ( defined $funcDef->{group} ) {
|
||||||
$canUse = $user->isInGroup( $functions->{$function}{group} );
|
$canUse = $user->isInGroup( $funcDef->{group} );
|
||||||
}
|
}
|
||||||
elsif ( defined $functions->{$function}{groupSetting} ) {
|
elsif ( defined $funcDef->{groupSetting} ) {
|
||||||
$canUse = $user->isInGroup( $setting->get( $functions->{$function}{groupSetting} ) );
|
$canUse = $user->isInGroup( $setting->get( $funcDef->{groupSetting} ) );
|
||||||
}
|
}
|
||||||
if ( $functions->{$function}{uiLevel} > $user->profileField("uiLevel") ) {
|
if ( $funcDef->{uiLevel} > $user->profileField("uiLevel") ) {
|
||||||
$canUse = 0;
|
$canUse = 0;
|
||||||
}
|
}
|
||||||
|
next unless $canUse;
|
||||||
|
|
||||||
# build the attributes
|
# build the attributes
|
||||||
$var = {
|
$var = {
|
||||||
title => $title,
|
title => $title,
|
||||||
icon => $url->extras( "/adminConsole/" . $functions->{$function}{icon} ),
|
icon => $url->extras( "/adminConsole/" . $funcDef->{icon} ),
|
||||||
'icon.small' => $url->extras( "adminConsole/small/" . $functions->{$function}{icon} ),
|
'icon.small' => $url->extras( "adminConsole/small/" . $funcDef->{icon} ),
|
||||||
url => $functions->{$function}{url},
|
url => $funcDef->{url},
|
||||||
canUse => $canUse,
|
|
||||||
};
|
};
|
||||||
} ## end else [ if ( $funcDef->{className...})]
|
|
||||||
|
|
||||||
# build the list of processed items
|
# build the list of processed items
|
||||||
$processed{$title} = $var;
|
$processed{$title} = $var;
|
||||||
|
|
||||||
|
} ## end else [ if ( $funcDef->{className...})]
|
||||||
|
|
||||||
} ## end foreach my $funcId ( keys %...)
|
} ## end foreach my $funcId ( keys %...)
|
||||||
|
|
||||||
|
|
@ -115,13 +124,15 @@ sub getVersionTagTemplateVars {
|
||||||
my $working = WebGUI::VersionTag->getWorking( $session, "nocreate" );
|
my $working = WebGUI::VersionTag->getWorking( $session, "nocreate" );
|
||||||
my $tags = WebGUI::VersionTag->getOpenTags($session);
|
my $tags = WebGUI::VersionTag->getOpenTags($session);
|
||||||
if ( @$tags ) {
|
if ( @$tags ) {
|
||||||
next unless $user->isInGroup( $tag->get("groupToUse") );
|
for my $tag ( @$tags ) {
|
||||||
push @$vars, {
|
next unless $user->isInGroup( $tag->get("groupToUse") );
|
||||||
name => $tag->get("name"),
|
push @$vars, {
|
||||||
isWorking => ( $working && $working->getId eq $tag->getId ) ? 1 : 0,
|
name => $tag->get("name"),
|
||||||
joinUrl => $tag->getJoinUrl,
|
isWorking => ( $working && $working->getId eq $tag->getId ) ? 1 : 0,
|
||||||
editUrl => $tag->getEditUrl,
|
joinUrl => $tag->getJoinUrl,
|
||||||
};
|
editUrl => $tag->getEditUrl,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $vars;
|
return $vars;
|
||||||
|
|
@ -138,7 +149,7 @@ Show the main Admin console wrapper
|
||||||
sub www_view {
|
sub www_view {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
my $session = $self->session;
|
my $session = $self->session;
|
||||||
my ( $user, $url ) = $session->quick(qw{ user url });
|
my ( $user, $url, $style ) = $session->quick(qw{ user url style });
|
||||||
|
|
||||||
my $var;
|
my $var;
|
||||||
$var->{backToSiteUrl} = $url->page;
|
$var->{backToSiteUrl} = $url->page;
|
||||||
|
|
@ -146,7 +157,7 @@ sub www_view {
|
||||||
# Add vars for AdminBar
|
# Add vars for AdminBar
|
||||||
$var->{adminPlugins} = $self->getAdminPluginTemplateVars;
|
$var->{adminPlugins} = $self->getAdminPluginTemplateVars;
|
||||||
$var->{versionTags} = $self->getVersionTagTemplateVars;
|
$var->{versionTags} = $self->getVersionTagTemplateVars;
|
||||||
$var->{clipboardAssets} = $self->getClipboardTemplateVars;
|
#$var->{clipboardAssets} = $self->getClipboardTemplateVars;
|
||||||
$var->{newContentTabs} = $self->getNewContentTemplateVars;
|
$var->{newContentTabs} = $self->getNewContentTemplateVars;
|
||||||
|
|
||||||
# Add vars for current user
|
# Add vars for current user
|
||||||
|
|
@ -161,10 +172,42 @@ sub www_view {
|
||||||
$var->{leaveUrl} = ""; #TODO
|
$var->{leaveUrl} = ""; #TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$style->setScript($url->extras('yui/build/utilities/utilities.js'), {type=>'text/javascript'});
|
||||||
|
$style->setScript($url->extras('accordion/accordion.js'), {type=>'text/javascript'});
|
||||||
|
$style->setLink($url->extras('macro/AdminBar/slidePanel.css'), {type=>'text/css', rel=>'stylesheet'});
|
||||||
|
|
||||||
# Use the template in our __DATA__ block
|
# Use the template in our __DATA__ block
|
||||||
|
my $tdata = do { local $/ = undef; <WebGUI::Admin::DATA> };
|
||||||
|
my $tmpl = WebGUI::Asset::Template::HTMLTemplate->new( $session );
|
||||||
|
|
||||||
# Use the blank style
|
# Use the blank style
|
||||||
|
my $output = $style->process( $tmpl->process( $tdata, $var ), "PBtmplBlankStyle000001" );
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
} ## end sub www_view
|
} ## end sub www_view
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
__DATA__
|
||||||
|
<div id="wrapper" class="yui-skin-sam">
|
||||||
|
|
||||||
|
<dl class="accordion-menu">
|
||||||
|
<dt class="a-m-t">^International("admin console","AdminConsole");</dt>
|
||||||
|
<dd class="a-m-d"><div class="bd">
|
||||||
|
<TMPL_LOOP adminPlugins>
|
||||||
|
<a class="link" href="<tmpl_var url>">
|
||||||
|
<img src="<tmpl_var icon.small>" style="border: 0px; vertical-align: middle;" alt="icon" />
|
||||||
|
<tmpl_var title>
|
||||||
|
</a>
|
||||||
|
</TMPL_LOOP>
|
||||||
|
</div></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<p>This is where cool stuff goes</p>
|
||||||
|
|
||||||
|
<!-- Put this in style where belongs -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
YAHOO.util.Event.onDOMReady(function () { document.body.style.marginLeft = "160px"; });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -63,5 +63,3 @@ sub handler {
|
||||||
|
|
||||||
1;
|
1;
|
||||||
#vim:ft=perl
|
#vim:ft=perl
|
||||||
|
|
||||||
__DATA__
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue