started adding new admin console

This commit is contained in:
JT Smith 2004-11-02 01:31:20 +00:00
parent 802e917376
commit c4fa16700d
17 changed files with 705 additions and 152 deletions

View file

@ -1,4 +1,5 @@
6.3.0
- Added a new, more user-friendly administrative console.
- bugfix [ 1045114 ] Columns randomly ordered in SQLReport (Len Kranendonk ,
tnx brother for reporting)
- Sped up Navigation.pm
@ -19,6 +20,7 @@
- bugfix [ 991070 ] 5.5.4 Editor(s) replacing ^ symbol
- bugfix [ 1022287 ] WYSIWYG-Editor Add new web link
- bugfix [ 1055153 ] Turn Admin ON with SSL and IE.
- Fixed a redirect loop problem.
6.2.8

View file

@ -10,3 +10,5 @@ INSERT INTO userProfileField VALUES ('richEditor','WebGUI::International::get(49
update userProfileData set fieldData='tinyMCE' where fieldName='richEditor';
UPDATE template set template = '<html>\r\n\r\n<script language=\"javascript\" src=\"<tmpl_var session.config.extrasURL>/tinymce/jscripts/tiny_mce/tiny_mce_popup.js\"></script>\r\n\r\n<script language=\"javascript\">\r\n\r\nfunction setLink(page) {\r\n document.getElementById(\"url\").value=\"^/;\" + page;\r\n}\r\n\r\nfunction createLink() {\r\n if (window.opener) { \r\n if (document.getElementById(\"url\").value == \"\") {\r\n alert(\"You must enter a link url\");\r\n document.getElementById(\"url\").focus();\r\n }\r\n\r\ntinyMCE.insertLink(document.getElementById(\"url\").value,document.getElementById(\"target\").value);\r\n window.close();\r\n }\r\n}\r\n\r\n</script>\r\n\r\n<body>\r\n\r\n<fieldset>\r\n<legend>Insert/Edit Link</legend>\r\n\r\n <fieldset>\r\n <legend>Link Settings</legend>\r\n <form name=\"linkchooser\">\r\n <table border=\"0\">\r\n <tr>\r\n <td>Link URL:</td>\r\n <td><input id=\"url\" name=\"url\" type=\"text value=\"\" style=\"width: 200px\"></td>\r\n </tr>\r\n <tr>\r\n <td>Link Target:</td>\r\n <td><select id=\"target\" name=\"target\" style=\"width: 200px\">\r\n <option value=\"_self\">Open link in same window</option>\r\n <option value=\"_blank\">Open link in new window</option>\r\n </select>\r\n </td>\r\n </tr>\r\n <tr><td colspan=\"2\">&nbsp;</td></tr>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\"><input type=\"button\" value=\"Cancel\" onClick=\"window.close()\"><input type=\"button\" value=\"Create Link\" onClick=\"createLink()\"></td>\r\n </tr>\r\n </table>\r\n </form>\r\n \r\n\r\n </fieldset> \r\n<br>\r\n\r\n\r\n <fieldset>\r\n <legend>Available Page Tree</legend>\r\n<div id=\"pagetree\" style=\"overflow: auto; height: 280; width: 441\">\r\n<tmpl_loop page_loop>\r\n <tmpl_var indent><a href=\"#\" onClick=\"setLink(\'<tmpl_var url>\')\"><tmpl_var title></a><br />\r\n</tmpl_loop>\r\n</div>\r\n </fieldset>\r\n \r\n</fieldset>\r\n</body>\r\n</html>' where namespace='richEditor/pagetree' && templateId = '1';
INSERT INTO template VALUES ('1','Admin Console','<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\r\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <title><tmpl_if application.title><tmpl_var application.title><tmpl_else><tmpl_var console.title></tmpl_if></title>\r\n <link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"^Extras;/adminConsole/adminConsole.css\" title=\"Menu Right\" />\r\n <script type=\"text/javascript\" lang=\"JavaScript\" src=\"^Extras;/adminConsole/adminConsole.js\"></script>\r\n</head>\r\n<body>\r\n<div id=\"application_help\">\r\n <tmpl_if help.url>\r\n <a href=\"<tmpl_var help.url>\" target=\"_blank\"><img src=\"^Extras;/adminConsole/help-small.gif\" alt=\"?\" border=\"0\" /></a>\r\n </tmpl_if>\r\n</div>\r\n<div id=\"application_icon\">\r\n <img src=\"<tmpl_var application.icon>\" border=\"0\" title=\"<tmpl_var application.title>\" alt=\"<tmpl_var application.title>\" />\r\n</div>\r\n<div id=\"console_icon\">\r\n <img src=\"<tmpl_var console.icon>\" border=\"0\" title=\"<tmpl_var console.title>\" alt=\"<tmpl_var console.title>\" />\r\n</div>\r\n<div id=\"application_title\">\r\n <tmpl_var application.title>\r\n</div>\r\n<div id=\"console_title\">\r\n <tmpl_var console.title>\r\n</div>\r\n<div id=\"application_workarea\">\r\n <tmpl_var application.workArea>\r\n</div>\r\n<div id=\"console_workarea\">\r\n <div class=\"adminConsoleSpacer\">\r\n &nbsp;\r\n </div>\r\n <tmpl_loop application_loop>\r\n <tmpl_if canUse>\r\n <div class=\"adminConsoleApplication\">\r\n <a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon>\" border=\"0\" title=\"<tmpl_var title>\" alt=\"<tmpl_var title>\" /></a><br />\r\n <a href=\"<tmpl_var url>\"><tmpl_var title></a>\r\n </div>\r\n </tmpl_if>\r\n </tmpl_loop>\r\n <div class=\"adminConsoleSpacer\">\r\n &nbsp;\r\n </div>\r\n</div>\r\n<div class=\"adminConsoleMenu\">\r\n <div class=\"adminConsoleMainMenu\">\r\n <div id=\"console_toggle_on\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.on.label></a><br />\r\n </div>\r\n <div id=\"console_toggle_off\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.off.label></a><br />\r\n </div>\r\n <a href=\"^/;\"><tmpl_var backtosite.label></a><br />\r\n </div>\r\n <div id=\"application_submenu\">\r\n <tmpl_loop submenu_loop>\r\n <a href=\"<tmpl_var url>\"><tmpl_var label></a><br />\r\n </tmpl_loop>\r\n </div>\r\n <div class=\"adminConsoleUtilityMenu\">\r\n ^AdminToggle;<br />\r\n ^LoginToggle;<br />\r\n </div>\r\n</div>\r\n<script lang=\"JavaScript\">\r\n initAdminConsole(<tmpl_if application.title>true<tmpl_else>false</tmpl_if>);\r\n</script>\r\n</body>\r\n</html>\r\n','AdminConsole',1,1);

252
lib/WebGUI/AdminConsole.pm Normal file
View file

@ -0,0 +1,252 @@
package WebGUI::AdminConsole;
use strict;
use WebGUI::Grouping;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Template;
use WebGUI::URL;
sub _formatFunction {
my $self = shift;
my $function = shift;
return {
title=>WebGUI::International::get($function->{title}{id}, $function->{title}{namespace}),
icon=>$session{config}{extrasURL}."/adminConsole/".$function->{icon},
url=>WebGUI::URL::page("op=".$function->{op}),
canUse=>WebGUI::Grouping::isInGroup($function->{group})
};
}
sub addSubmenuItem {
my $self = shift;
my $url = shift;
my $label = shift;
push (@{$self->{_submenuItem}}, {
url=>$url,
label=>$label
});
}
sub getAdminFunction {
my $self = shift;
my $id = shift;
my $functions = { # at some point in the future we'll need to make this pluggable/configurable
"assets"=>{
title=>{
id=>"assets",
namespace=>"Asset"
},
icon=>"assets.gif",
op=>"manageAssets",
group=>"12"
},
"users"=>{
title=>{
id=>"users",
namespace=>"WebGUI"
},
icon=>"users.gif",
op=>"listUsers",
group=>"11"
},
"navigation"=>{
title=>{
id=>"navigation",
namespace=>"Navigation"
},
icon=>"navigation.gif",
op=>"listNavigation",
group=>"4"
},
"clipboard"=>{
title=>{
id=>"948",
namespace=>"WebGUI"
},
icon=>"clipboard.gif",
op=>"manageClipboard",
group=>"4"
},
"trash"=>{
title=>{
id=>"trash",
namespace=>"WebGUI"
},
icon=>"trash.gif",
op=>"manageTrash",
group=>"3"
},
"databases"=>{
title=>{
id=>"databases",
namespace=>"WebGUI"
},
icon=>"databases.gif",
op=>"listDatabaseLinks",
group=>"3"
},
"groups"=>{
title=>{
id=>"groups",
namespace=>"WebGUI"
},
icon=>"groups.gif",
op=>"listGroups",
group=>"11"
},
"packages"=>{
title=>{
id=>"packages",
namespace=>"WebGUI"
},
icon=>"packages.gif",
op=>"managePackages",
group=>"4"
},
"settings"=>{
title=>{
id=>"settings",
namespace=>"WebGUI"
},
icon=>"settings.gif",
op=>"manageSettings",
group=>"3"
},
"templates"=>{
title=>{
id=>"templates",
namespace=>"WebGUI"
},
icon=>"templates.gif",
op=>"listTemplates",
group=>"8"
},
"themes"=>{
title=>{
id=>"themes",
namespace=>"WebGUI"
},
icon=>"themes.gif",
op=>"listThemes",
group=>"9"
},
"help"=>{
title=>{
id=>"help",
namespace=>"WebGUI"
},
icon=>"help.gif",
op=>"viewHelpIndex",
group=>"7"
},
"statistics"=>{
title=>{
id=>"437",
namespace=>"WebGUI"
},
icon=>"statistics.gif",
op=>"viewStatistics",
group=>"12"
},
"contentProfiling"=>{
title=>{
id=>"content profiling",
namespace=>"MetaData"
},
icon=>"contentProfiling.gif",
op=>"manageMetaData",
group=>"4"
},
"contentFilters"=>{
title=>{
id=>"content filters",
namespace=>"WebGUI"
},
icon=>"contentFilters.gif",
op=>"listReplacements",
group=>"4"
},
"userProfileSettings"=>{
title=>{
id=>"user profile settings",
namespace=>"WebGUI"
},
icon=>"userProfileSettings.gif",
op=>"editProfileSettings",
group=>"3"
},
"loginHistory"=>{
title=>{
id=>"426",
namespace=>"WebGUI"
},
icon=>"loginHistory.gif",
op=>"viewLoginHistory",
group=>"3"
},
"activeSessions"=>{
title=>{
id=>"425",
namespace=>"WebGUI"
},
icon=>"activeSessions.gif",
op=>"viewActiveSessions",
group=>"3"
},
};
if ($id) {
return $self->_formatFunction($functions->{$id});
} else {
my @list;
foreach my $id (keys %{$functions}) {
push(@list,$self->_formatFunction($functions->{$id}));
}
return \@list;
}
}
sub new {
my $class = shift;
bless {}, $class;
}
sub render {
my $self = shift;
my %var;
$var{"application.workarea"} = shift;
$var{"application.title"} = shift || $self->{_function}{title};
$session{page}{useEmptyStyle} = 1;
$var{"backtosite.label"} = WebGUI::International::get("493");
$var{"toggle.on.label"} = WebGUI::International::get("toggle on", "AdminConsole");
$var{"toggle.off.label"} = WebGUI::International::get("toggle off","AdminConsole");
$var{"application.icon"} = $self->{_function}{icon};
$var{"application.canUse"} = $self->{_function}{canUse};
$var{"application.url"} = $self->{_function}{url};
if (exists $self->{_submenuItem}) {
$var{submenu_loop} = $self->{_submenuItem};
}
$var{"console.title"} = WebGUI::International::get("admin console","AdminConsole");
$var{"console.url"} = WebGUI::URL::page("op=adminConsole");
$var{"console.canUse"} = WebGUI::Grouping::isInGroup("12");
$var{"console.icon"} = $session{config}{extrasURL}."/adminConsole/adminConsole.gif";
$var{"help.url"} = $self->{_helpUrl};
$var{"application_loop"} = $self->getAdminFunction;
return WebGUI::Template::process($session{setting}{AdminConsoleTemplate}, "AdminConsole", \%var);
}
sub setAdminFunction {
my $self = shift;
my $id = shift;
$self->{_function} = $self->getAdminFunction($id);
}
sub setHelp {
my $self = shift;
my $id = shift;
my $namespace = shift || "WebGUI";
$self->{_helpUrl} = WebGUI::URL::page('op=viewHelp&hid='.$id.'&namespace='.$namespace)
}
1;

View file

@ -77,6 +77,7 @@ Returns a hash reference containing operation and package names.
sub getOperations {
return {
'adminConsole' => 'WebGUI::Operation::Admin',
'switchOffAdmin' => 'WebGUI::Operation::Admin',
'switchOnAdmin' => 'WebGUI::Operation::Admin',
'auth' => 'WebGUI::Operation::Auth',
@ -200,9 +201,9 @@ sub getOperations {
'viewPageReport' => 'WebGUI::Operation::Statistics',
'viewStatistics' => 'WebGUI::Operation::Statistics',
'viewTrafficReport' => 'WebGUI::Operation::Statistics',
'killSession' => 'WebGUI::Operation::Statistics',
'viewLoginHistory' => 'WebGUI::Operation::Statistics',
'viewActiveSessions' => 'WebGUI::Operation::Statistics',
'killSession' => 'WebGUI::Operation::ActiveSessions',
'viewLoginHistory' => 'WebGUI::Operation::LoginHistory',
'viewActiveSessions' => 'WebGUI::Operation::ActiveSessions',
'makePrintable' => 'WebGUI::Operation::Style',
'setPersonalStyle' => 'WebGUI::Operation::Style',
'unsetPersonalStyle' => 'WebGUI::Operation::Style',

View file

@ -0,0 +1,66 @@
package WebGUI::Operation::ActiveSessions;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2004 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::AdminConsole;
use WebGUI::DateTime;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
sub www_killSession {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
WebGUI::Session::end($session{form}{sid});
return www_viewActiveSessions();
}
#-------------------------------------------------------------------
sub www_viewActiveSessions {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my ($output, $p, @row, $i, $sth, %data);
tie %data, 'Tie::CPHash';
$sth = WebGUI::SQL->read("select users.username,users.userId,userSession.sessionId,userSession.expires,
userSession.lastPageView,userSession.lastIP from users,userSession where users.userId=userSession.userId
and users.userId<>1 order by users.username,userSession.lastPageView desc");
while (%data = $sth->hash) {
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
$row[$i] .= '<td>'.$data{sessionId}.'</td>';
$row[$i] .= '<td>'.epochToHuman($data{expires}).'</td>';
$row[$i] .= '<td>'.epochToHuman($data{lastPageView}).'</td>';
$row[$i] .= '<td>'.$data{lastIP}.'</td>';
$row[$i] .= '<td align="center">'.deleteIcon("op=killSession&sid=$data{sessionId}").'</td></tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewActiveSessions'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
$output .= '<td>'.WebGUI::International::get(435).'</td>';
$output .= '<td>'.WebGUI::International::get(432).'</td>';
$output .= '<td>'.WebGUI::International::get(430).'</td>';
$output .= '<td>'.WebGUI::International::get(431).'</td>';
$output .= '<td>'.WebGUI::International::get(436).'</td></tr>';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});
my $ac = WebGUI::AdminConsole->new;
$ac->setAdminFunction("activeSessions");
return $ac->render($output);
}
1;

View file

@ -11,10 +11,18 @@ package WebGUI::Operation::Admin;
#-------------------------------------------------------------------
use strict;
use WebGUI::AdminConsole;
use WebGUI::Grouping;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
sub www_adminConsole {
return "" unless (WebGUI::Grouping::isInGroup(12));
my $ac = WebGUI::AdminConsole->new;
return $ac->render;
}
#-------------------------------------------------------------------
sub www_switchOffAdmin {
return "" unless (WebGUI::Grouping::isInGroup(12));

View file

@ -11,12 +11,12 @@ package WebGUI::Operation::Clipboard;
#-------------------------------------------------------------------
use strict;
use WebGUI::AdminConsole;
use WebGUI::DateTime;
use WebGUI::Grouping;
use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Operation::Shared;
use WebGUI::Page;
use WebGUI::Paginator;
use WebGUI::Privilege;
@ -26,21 +26,29 @@ use WebGUI::TabForm;
use WebGUI::URL;
use WebGUI::Utility;
#-------------------------------------------------------------------
sub _submenu {
my (%menu);
tie %menu, 'Tie::IxHash';
$menu{WebGUI::URL::page('op=manageClipboard')} = WebGUI::International::get(949);
my $workarea = shift;
my $title = shift;
$title = WebGUI::International::get($title) if ($title);
my $help = shift;
my $ac = WebGUI::AdminConsole->new;
if ($help) {
$ac->setHelp($help);
}
$ac->setAdminFunction("clipboard");
$ac->addSubmenuItem(WebGUI::URL::page('op=manageClipboard'), WebGUI::International::get(949));
if ($session{form}{systemClipboard} ne "1") {
$menu{WebGUI::URL::page('op=emptyClipboard')} = WebGUI::International::get(950);
$ac->addSubmenuItem(WebGUI::URL::page('op=emptyClipboard'), WebGUI::International::get(950));
}
if ( ($session{setting}{sharedClipboard} ne "1") && (WebGUI::Grouping::isInGroup(3)) ) {
$menu{WebGUI::URL::page('op=manageClipboard&systemClipboard=1')} = WebGUI::International::get(954);
$ac->addSubmenuItem(WebGUI::URL::page('op=manageClipboard&systemClipboard=1'), WebGUI::International::get(954));
if ($session{form}{systemClipboard} eq "1") {
$menu{WebGUI::URL::page('op=emptyClipboard&systemClipboard=1')} = WebGUI::International::get(959);
$ac->addSubmenuItem(WebGUI::URL::page('op=emptyClipboard&systemClipboard=1'), WebGUI::International::get(959));
}
}
return menuWrapper($_[0],\%menu);
return $ac->render($workarea, $title);
}
@ -48,12 +56,12 @@ sub _submenu {
sub www_deleteClipboardItem {
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
my ($output);
my $help;
if ($session{form}{wid} ne "") {
$output .= helpIcon("wobject delete");
$help = "wobject delete";
} elsif ($session{form}{pageId} ne "") {
$output .= helpIcon("page delete");
$help = "page delete";
}
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(956).'<p>';
if ($session{form}{wid} ne "") {
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deleteClipboardItemConfirm&wid='
@ -64,7 +72,7 @@ sub www_deleteClipboardItem {
}
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">'
.WebGUI::International::get(45).'</a></div>';
return $output;
return _submenu($output,"42",$help);
}
#-------------------------------------------------------------------
@ -119,8 +127,6 @@ sub www_deleteClipboardItemConfirm {
sub www_emptyClipboard {
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
my ($output);
$output = helpIcon("clipboard empty");
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(951).'<p>';
if ( ($session{setting}{sharedClipboard} ne "1") && (WebGUI::Grouping::isInGroup(3)) ) {
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=emptyClipboardConfirm&systemClipboard=1')
@ -129,9 +135,9 @@ sub www_emptyClipboard {
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=emptyClipboardConfirm')
.'">'.WebGUI::International::get(44).'</a>';
}
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">'
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page("op=manageClipboard").'">'
.WebGUI::International::get(45).'</a></div>';
return $output;
return _submenu($output,"42","clipboard empty");
}
#-------------------------------------------------------------------
@ -181,20 +187,18 @@ sub www_emptyClipboardConfirm {
sub www_manageClipboard {
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
my ($sth, @data, @row, @sorted_row, $i, $p, $allUsers);
my $output = helpIcon("clipboard manage");
my ($sth, @data, @row, @sorted_row, $i, $p, $allUsers, $title);
my $output;
# Add appropriate html page header
if ($session{setting}{sharedClipboard} eq "1") {
$allUsers = 1;
$output .= '<h1>'. WebGUI::International::get(948) .'</h1>';
} elsif ($session{form}{systemClipboard} eq "1") {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
$allUsers = 1;
$output .= '<h1>'. WebGUI::International::get(955) .'</h1>';
$title = '955';
} else {
$allUsers = 0;
$output .= '<h1>'. WebGUI::International::get(948) .'</h1>';
}
# Generate list of pages in clipboard
@ -331,7 +335,7 @@ sub www_manageClipboard {
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});
return _submenu($output);
return _submenu($output, $title, "clipboard manage");
}
1;

View file

@ -12,12 +12,12 @@ package WebGUI::Operation::DatabaseLink;
use strict;
use Tie::CPHash;
use WebGUI::AdminConsole;
use WebGUI::DatabaseLink;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::Id;
use WebGUI::International;
use WebGUI::Operation::Shared;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
@ -26,16 +26,23 @@ use WebGUI::URL;
#-------------------------------------------------------------------
sub _submenu {
my (%menu);
tie %menu, 'Tie::IxHash';
$menu{WebGUI::URL::page('op=editDatabaseLink&dlid=new')} = WebGUI::International::get(982);
my $workarea = shift;
my $title = shift;
$title = WebGUI::International::get($title) if ($title);
my $help = shift;
my $ac = WebGUI::AdminConsole->new;
if ($help) {
$ac->setHelp($help);
}
$ac->setAdminFunction("databases");
$ac->addSubmenuItem(WebGUI::URL::page('op=editDatabaseLink&dlid=new'), WebGUI::International::get(982));
if (($session{form}{op} eq "editDatabaseLink" && $session{form}{dlid} ne "new") || $session{form}{op} eq "deleteDatabaseLink") {
$menu{WebGUI::URL::page('op=editDatabaseLink&dlid='.$session{form}{dlid})} = WebGUI::International::get(983);
$menu{WebGUI::URL::page('op=copyDatabaseLink&dlid='.$session{form}{dlid})} = WebGUI::International::get(984);
$menu{WebGUI::URL::page('op=deleteDatabaseLink&dlid='.$session{form}{dlid})} = WebGUI::International::get(985);
$menu{WebGUI::URL::page('op=listDatabaseLinks')} = WebGUI::International::get(986);
$ac->addSubmenuItem(WebGUI::URL::page('op=editDatabaseLink&dlid='.$session{form}{dlid}), WebGUI::International::get(983));
$ac->addSubmenuItem(WebGUI::URL::page('op=copyDatabaseLink&dlid='.$session{form}{dlid}), WebGUI::International::get(984));
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteDatabaseLink&dlid='.$session{form}{dlid}), WebGUI::International::get(985));
$ac->addSubmenuItem(WebGUI::URL::page('op=listDatabaseLinks'), WebGUI::International::get(986));
}
return menuWrapper($_[0],\%menu);
return $ac->render($workarea, $title);
}
#-------------------------------------------------------------------
@ -53,8 +60,6 @@ sub www_copyDatabaseLink {
sub www_deleteDatabaseLink {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
my ($output);
$output .= helpIcon("database link delete");
$output .= '<h1>'.WebGUI::International::get(987).'</h1>';
$output .= WebGUI::International::get(988).'<p>';
foreach my $using (WebGUI::DatabaseLink::whatIsUsing($session{form}{dlid})) {
if ($using->{title}) {
@ -69,7 +74,7 @@ sub www_deleteDatabaseLink {
.'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page('op=listDatabaseLinks').
'">'.WebGUI::International::get(45).'</a></div>';
return _submenu($output);
return _submenu($output,"987","database link delete");
}
#-------------------------------------------------------------------
@ -89,8 +94,6 @@ sub www_editDatabaseLink {
} else {
%db = WebGUI::SQL->quickHash("select * from databaseLink where databaseLinkId=".quote($session{form}{dlid}));
}
$output .= helpIcon("database link add/edit");
$output .= '<h1>'.WebGUI::International::get(990).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("op","editDatabaseLinkSave");
$f->hidden("dlid",$session{form}{dlid});
@ -101,7 +104,7 @@ sub www_editDatabaseLink {
$f->password("identifier",WebGUI::International::get(995),$db{identifier});
$f->submit;
$output .= $f->print;
return _submenu($output);
return _submenu($output,"990","database link add/edit");
}
#-------------------------------------------------------------------
@ -120,8 +123,6 @@ sub www_editDatabaseLinkSave {
sub www_listDatabaseLinks {
return WebGUI::Privilege::adminOnly() unless(WebGUI::Grouping::isInGroup(3));
my ($output, $p, $sth, %data, @row, $i);
$output = helpIcon("database links manage");
$output .= '<h1>'.WebGUI::International::get(996).'</h1>';
$sth = WebGUI::SQL->read("select * from databaseLink order by title");
$row[$i] = '<tr><td valign="top" class="tableData"></td><td valign="top" class="tableData">'.WebGUI::International::get(1076).'</td></tr>';
$i++;
@ -141,7 +142,7 @@ sub www_listDatabaseLinks {
$output .= $p->getPage;
$output .= '</table>';
$output .= $p->getBarTraditional;
return _submenu($output);
return _submenu($output,"database links manage");
}

View file

@ -0,0 +1,56 @@
package WebGUI::Operation::LoginHistory;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2004 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::AdminConsole;
use WebGUI::DateTime;
use WebGUI::Grouping;
use WebGUI::International;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
sub www_viewLoginHistory {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my ($output, $p, @row, $i, $sth, %data);
tie %data, 'Tie::CPHash';
$sth = WebGUI::SQL->read("select * from users,userLoginLog where users.userId=userLoginLog.userId order by userLoginLog.timeStamp desc");
while (%data = $sth->hash) {
$data{username} = 'unknown user' if ($data{userId} eq "0");
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
$row[$i] .= '<td>'.$data{status}.'</td>';
$row[$i] .= '<td>'.epochToHuman($data{timeStamp},"%H:%n%p %M/%D/%y").'</td>';
$row[$i] .= '<td>'.$data{ipAddress}.'</td>';
$row[$i] .= '<td>'.$data{userAgent}.'</td></tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
$output .= '<td>'.WebGUI::International::get(434).'</td>';
$output .= '<td>'.WebGUI::International::get(429).'</td>';
$output .= '<td>'.WebGUI::International::get(431).'</td>';
$output .= '<td>'.WebGUI::International::get(433).'</td></tr>';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBar($session{form}{pn});
my $ac = WebGUI::AdminConsole->new;
$ac->setAdminFunction("loginHistory");
return $ac->render($output);
}
1;

View file

@ -11,99 +11,27 @@ package WebGUI::Operation::Statistics;
#-------------------------------------------------------------------
use strict;
use WebGUI::AdminConsole;
use WebGUI::Cache;
use WebGUI::DateTime;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Operation::Shared;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
sub _submenu {
my (%menu);
tie %menu, 'Tie::IxHash';
$menu{WebGUI::URL::page("op=viewActiveSessions")} = WebGUI::International::get(423);
$menu{WebGUI::URL::page("op=viewLoginHistory")} = WebGUI::International::get(424);
$menu{WebGUI::URL::page("op=viewPageReport")} = WebGUI::International::get(796);
# $menu{WebGUI::URL::page("op=viewTrafficReport")} = WebGUI::International::get(797);
$menu{WebGUI::URL::page('op=viewStatistics')} = WebGUI::International::get(144);
return menuWrapper($_[0],\%menu);
}
#-------------------------------------------------------------------
sub www_killSession {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
WebGUI::Session::end($session{form}{sid});
return www_viewActiveSessions();
}
#-------------------------------------------------------------------
sub www_viewActiveSessions {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my ($output, $p, @row, $i, $sth, %data);
tie %data, 'Tie::CPHash';
$output = '<h1>'.WebGUI::International::get(425).'</h1>';
$sth = WebGUI::SQL->read("select users.username,users.userId,userSession.sessionId,userSession.expires,
userSession.lastPageView,userSession.lastIP from users,userSession where users.userId=userSession.userId
and users.userId<>1 order by users.username,userSession.lastPageView desc");
while (%data = $sth->hash) {
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
$row[$i] .= '<td>'.$data{sessionId}.'</td>';
$row[$i] .= '<td>'.epochToHuman($data{expires}).'</td>';
$row[$i] .= '<td>'.epochToHuman($data{lastPageView}).'</td>';
$row[$i] .= '<td>'.$data{lastIP}.'</td>';
$row[$i] .= '<td align="center">'.deleteIcon("op=killSession&sid=$data{sessionId}").'</td></tr>';
$i++;
my $workarea = shift;
my $title = shift;
$title = WebGUI::International::get($title) if ($title);
my $ac = WebGUI::AdminConsole->new;
$ac->setAdminFunction("statistics");
if ($session{setting}{trackPageStatistics}) {
$ac->addSubmenuItem( WebGUI::URL::page("op=viewPageReport"), WebGUI::International::get(796));
# $ac->addSubmenuItem( WebGUI::URL::page("op=viewTrafficReport"), WebGUI::International::get(797));
$ac->addSubmenuItem( WebGUI::URL::page('op=viewStatistics'), WebGUI::International::get(144));
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewActiveSessions'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
$output .= '<td>'.WebGUI::International::get(435).'</td>';
$output .= '<td>'.WebGUI::International::get(432).'</td>';
$output .= '<td>'.WebGUI::International::get(430).'</td>';
$output .= '<td>'.WebGUI::International::get(431).'</td>';
$output .= '<td>'.WebGUI::International::get(436).'</td></tr>';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});
return _submenu($output);
}
#-------------------------------------------------------------------
sub www_viewLoginHistory {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my ($output, $p, @row, $i, $sth, %data);
tie %data, 'Tie::CPHash';
$output = '<h1>'.WebGUI::International::get(426).'</h1>';
$sth = WebGUI::SQL->read("select * from users,userLoginLog where users.userId=userLoginLog.userId order by userLoginLog.timeStamp desc");
while (%data = $sth->hash) {
$data{username} = 'unknown user' if ($data{userId} eq "0");
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
$row[$i] .= '<td>'.$data{status}.'</td>';
$row[$i] .= '<td>'.epochToHuman($data{timeStamp},"%H:%n%p %M/%D/%y").'</td>';
$row[$i] .= '<td>'.$data{ipAddress}.'</td>';
$row[$i] .= '<td>'.$data{userAgent}.'</td></tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory'));
$p->setDataByArrayRef(\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
$output .= '<td>'.WebGUI::International::get(434).'</td>';
$output .= '<td>'.WebGUI::International::get(429).'</td>';
$output .= '<td>'.WebGUI::International::get(431).'</td>';
$output .= '<td>'.WebGUI::International::get(433).'</td></tr>';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBar($session{form}{pn});
return _submenu($output);
return $ac->render($workarea, $title);
}
#-------------------------------------------------------------------
@ -111,7 +39,6 @@ sub www_viewPageReport {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my ($output, $count, $user, $data, $sth, %page, $pageId);
tie %page, "Tie::IxHash";
$output = '<h1>Page Statistics</h1>';
unless ($session{setting}{trackPageStatistics}) {
$output .= WebGUI::International::get(802);
} else {
@ -146,7 +73,7 @@ sub www_viewPageReport {
}
$output .= '</table>';
}
return _submenu($output);
return _submenu($output,"page statistics");
}
#-------------------------------------------------------------------
@ -160,9 +87,8 @@ sub www_viewStatistics {
$version = $cache->setByHTTP($url,43200);
}
chomp $version;
$output .= '<h1>'.WebGUI::International::get(437).'</h1>';
$output .= '<table>';
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(145).':</td><td class="tableData">'.$WebGUI::VERSION.'</td></tr>';
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(145).':</td><td class="tableData">'.$WebGUI::VERSION.'-'.$WebGUI::STATUS.'</td></tr>';
if ($version ne $WebGUI::VERSION) {
my @rev = split(/\./,$version);

View file

@ -0,0 +1,25 @@
package WebGUI::i18n::English::AdminConsole;
our $I18N = {
'admin console' => {
message => q|WebGUI Admin Console|,
lastUpdated => 1099344172,
context => q|The title of the admin console.|
},
'toggle on' => {
message => q|Show admin console.|,
lastUpdated => 1099344172,
context => q|A message indicating that clicking on the link will display the admin console.|
},
'toggle off' => {
message => q|Hide admin console.|,
lastUpdated => 1099344172,
context => q|A message indicating the clicking on the link will hide the admin console.|
},
};
1;

View file

@ -0,0 +1,12 @@
package WebGUI::i18n::English::Asset;
our $I18N = {
'assets' => {
message => q|Assets|,
lastUpdated => 1099344172,
context => q|The title of the asset manager for the admin console.|
},
};
1;

View file

@ -76,6 +76,12 @@ our $I18N = {
lastUpdated => 1089039511
},
'content profiling' => {
message => q|Content Profiling|,
lastUpdated => 1089039511,
context => q|The title of the content profiling manager for the admin console.|
},
};
1;

View file

@ -182,6 +182,12 @@ our $I18N = {
lastUpdated => 1077078526
},
'navigation' => {
message => q|Navigation|,
lastUpdated => 1077078526,
context => q|Title of the navigation manager in the admin console.|
},
};
1;

View file

@ -118,7 +118,8 @@ our $I18N = {
'437' => {
message => q|Statistics|,
lastUpdated => 1031514049
lastUpdated => 1031514049,
context => q|Title of the statistics viewer for the admin console.|
},
'463' => {
@ -330,8 +331,8 @@ The URL of the web site for this theme's designer. If you are in the business of
},
'948' => {
message => q|Manage Clipboard|,
lastUpdated => 1052850265
message => q|Clipboard|,
lastUpdated => 1099360884
},
'378' => {
@ -2687,7 +2688,8 @@ Settings relating to users (beyond profile information), like authentication inf
'426' => {
message => q|Login History|,
lastUpdated => 1031514049
lastUpdated => 1031514049,
context => q|Title of the login history viewer for the admin console.|
},
'542' => {
@ -2695,11 +2697,6 @@ Settings relating to users (beyond profile information), like authentication inf
lastUpdated => 1031514049
},
'996' => {
message => q|Manage Database Links|,
lastUpdated => 1056151382
},
'369' => {
message => q|Expire Date|,
lastUpdated => 1031514049
@ -3549,7 +3546,8 @@ Loops come with special condition variables of their own. They are __FIRST__, __
'425' => {
message => q|Active Sessions|,
lastUpdated => 1031514049
lastUpdated => 1031514049,
context => q|Title of the active sessions manager for the admin console.|
},
'745' => {
@ -3790,11 +3788,6 @@ You also cannot import a theme from a version of WebGUI that is newer than the o
lastUpdated => 1031514049
},
'424' => {
message => q|View login history.|,
lastUpdated => 1031514049
},
'872' => {
message => q|Who can view?|,
lastUpdated => 1044218038
@ -5177,11 +5170,6 @@ You can organize collateral into different folders, but names must be unique, ev
lastUpdated => 1068703399
},
'423' => {
message => q|View active sessions.|,
lastUpdated => 1031514049
},
'612' => {
message => q|There is no need to ever actually delete a user. If you are concerned with locking out a user, then simply change their password. If you truely wish to delete a user, then please keep in mind that there are consequences. If you delete a user any content that they added to the site via wobjects (like message boards and user contributions) will remain on the site. However, if another user tries to visit the deleted user's profile they will get an error message. Also if the user ever is welcomed back to the site, there is no way to give him/her access to his/her old content items except by re-adding the user to the users table manually.
<p>
@ -5912,8 +5900,8 @@ Start typing! Or better yet, copy the snippet from some other electronic documen
},
'955' => {
message => q|Manage System Clipboard|,
lastUpdated => 1052850265
message => q|System Clipboard|,
lastUpdated => 1099360884
},
'407' => {
@ -7464,6 +7452,79 @@ config file.</p>
context => q|Label of the cancel button|
},
'users' => {
message => q|Users|,
lastUpdated =>1092930637,
context => q|Title of the user manager for the admin console.|
},
'trash' => {
message => q|Trash|,
lastUpdated =>1092930637,
context => q|Title of the trash manager for the admin console.|
},
'databases' => {
message => q|Databases|,
lastUpdated =>1092930637,
context => q|Title of the database manager for the admin console.|
},
'groups' => {
message => q|Groups|,
lastUpdated =>1092930637,
context => q|Title of the group manager for the admin console.|
},
'packages' => {
message => q|Packages|,
lastUpdated =>1092930637,
context => q|Title of the package manager for the admin console.|
},
'settings' => {
message => q|Settings|,
lastUpdated =>1092930637,
context => q|Title of the settings manager for the admin console.|
},
'templates' => {
message => q|Templates|,
lastUpdated =>1092930637,
context => q|Title of the templates manager for the admin console.|
},
'themes' => {
message => q|Themes|,
lastUpdated =>1092930637,
context => q|Title of the themes manager for the admin console.|
},
'help' => {
message => q|Help|,
lastUpdated =>1092930637,
context => q|Title of the help index for the admin console.|
},
'content filters' => {
message => q|Content Filters|,
lastUpdated =>1092930637,
context => q|Title of the content filters manager for the admin console.|
},
'user profile settings' => {
message => q|User Profile Settings|,
lastUpdated =>1092930637,
context => q|Title of the user profile settings manager for the admin console.|
},
'page statistics' => {
message => q|Page Statistics|,
lastUpdated =>1092930637,
context => q|Title of the page statistics viewer for the admin console.|
},
};
1;

View file

@ -0,0 +1,77 @@
.adminConsoleTitleIcon {
position: absolute;
top: 0px;
left: 20px;
width: 72px;
height: 72px;
text-align: center;
border: 1px solid #ddd;
}
.adminConsoleTitle {
position: absolute;
top: 0px;
left: 102px;
font-size: 60px;
text-align: left;
}
.adminConsoleWorkArea {
border: 1px solid #ddd;
margin: 90px 220px 50px 10px;
padding: 5px;
}
.adminConsoleMenu {
position: absolute;
top: 85px;
right: 20px;
width: 180px;
/* border: 1px solid #ddd;
padding: 5px; */
}
.adminConsoleMainMenu {
border: 1px solid #ddd;
padding: 5px;
margin: 5px;
}
.adminConsoleSubmenu {
border: 1px solid #ddd;
padding: 5px;
margin: 5px;
}
.adminConsoleUtilityMenu {
border: 1px solid #ddd;
padding: 5px;
margin: 5px;
}
.adminConsoleHidden {
display: none;
height: 0px;
}
.adminConsoleApplication {
float: left;
padding: 15px;
text-align: center;
width: 100px;
}
.adminConsoleSpacer {
clear: both;
}
.adminConsoleToggle {
display: block;
}
.adminConsoleHelpIcon {
position: absolute;
top: 85px;
right: 220px;
}

View file

@ -0,0 +1,48 @@
var adminConsoleIsOn = true;
function initAdminConsole (app) {
if (app) {
switchToApplication();
} else {
switchToAdminConsole();
}
}
function switchToApplication () {
adminConsoleIsOn = false;
document.getElementById("console_icon").className = "adminConsoleHidden";
document.getElementById("console_title").className = "adminConsoleHidden";
document.getElementById("console_workarea").className = "adminConsoleHidden";
document.getElementById("application_help").className = "adminConsoleHelpIcon";
document.getElementById("application_icon").className = "adminConsoleTitleIcon";
document.getElementById("application_title").className = "adminConsoleTitle";
document.getElementById("application_submenu").className = "adminConsoleSubmenu";
document.getElementById("application_workarea").className = "adminConsoleWorkArea";
document.getElementById("console_toggle_off").className = "adminConsoleHidden";
document.getElementById("console_toggle_on").className = "adminConsoleToggle";
}
function switchToAdminConsole () {
adminConsoleIsOn = true;
document.getElementById("application_icon").className = "adminConsoleHidden";
document.getElementById("application_title").className = "adminConsoleHidden";
document.getElementById("application_submenu").className = "adminConsoleHidden";
document.getElementById("application_workarea").className = "adminConsoleHidden";
document.getElementById("application_help").className = "adminConsoleHidden";
document.getElementById("console_icon").className = "adminConsoleTitleIcon";
document.getElementById("console_title").className = "adminConsoleTitle";
document.getElementById("console_workarea").className = "adminConsoleWorkArea";
document.getElementById("console_toggle_off").className = "adminConsoleToggle";
document.getElementById("console_toggle_on").className = "adminConsoleHidden";
}
function toggleAdminConsole () {
if (adminConsoleIsOn) {
switchToApplication();
} else {
switchToAdminConsole();
}
}