diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 498ba677f..4bf7a19a7 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -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 diff --git a/docs/upgrades/upgrade_6.2.8-6.3.0.sql b/docs/upgrades/upgrade_6.2.8-6.3.0.sql index 87d46eb39..f34be24ef 100644 --- a/docs/upgrades/upgrade_6.2.8-6.3.0.sql +++ b/docs/upgrades/upgrade_6.2.8-6.3.0.sql @@ -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 = '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\nInsert/Edit Link\r\n\r\n
\r\n Link Settings\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Link URL:
Link Target:\r\n
 
\r\n
\r\n \r\n\r\n
\r\n
\r\n\r\n\r\n
\r\n Available Page Tree\r\n
\r\n\r\n \')\">
\r\n
\r\n
\r\n
\r\n \r\n
\r\n\r\n' where namespace='richEditor/pagetree' && templateId = '1'; +INSERT INTO template VALUES ('1','Admin Console','\r\n\r\n\r\n <tmpl_if application.title><tmpl_var application.title><tmpl_else><tmpl_var console.title></tmpl_if>\r\n \r\n \r\n\r\n\r\n
\r\n \r\n \" target=\"_blank\">\"?\"\r\n \r\n
\r\n
\r\n \" border=\"0\" title=\"\" alt=\"\" />\r\n
\r\n
\r\n \" border=\"0\" title=\"\" alt=\"\" />\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n  \r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n  \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \">
\r\n
\r\n
\r\n
\r\n ^AdminToggle;
\r\n ^LoginToggle;
\r\n
\r\n
\r\n\r\n\r\n\r\n','AdminConsole',1,1); + diff --git a/lib/WebGUI/AdminConsole.pm b/lib/WebGUI/AdminConsole.pm new file mode 100644 index 000000000..9fbcd597a --- /dev/null +++ b/lib/WebGUI/AdminConsole.pm @@ -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; + diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm index 434653922..6a0f713ad 100644 --- a/lib/WebGUI/Operation.pm +++ b/lib/WebGUI/Operation.pm @@ -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', diff --git a/lib/WebGUI/Operation/ActiveSessions.pm b/lib/WebGUI/Operation/ActiveSessions.pm new file mode 100644 index 000000000..badf1db7c --- /dev/null +++ b/lib/WebGUI/Operation/ActiveSessions.pm @@ -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] = ''.$data{username}.' ('.$data{userId}.')'; + $row[$i] .= ''.$data{sessionId}.''; + $row[$i] .= ''.epochToHuman($data{expires}).''; + $row[$i] .= ''.epochToHuman($data{lastPageView}).''; + $row[$i] .= ''.$data{lastIP}.''; + $row[$i] .= ''.deleteIcon("op=killSession&sid=$data{sessionId}").''; + $i++; + } + $sth->finish; + $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewActiveSessions')); + $p->setDataByArrayRef(\@row); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= $p->getPage($session{form}{pn}); + $output .= '
'.WebGUI::International::get(428).''.WebGUI::International::get(435).''.WebGUI::International::get(432).''.WebGUI::International::get(430).''.WebGUI::International::get(431).''.WebGUI::International::get(436).'
'; + $output .= $p->getBarTraditional($session{form}{pn}); + my $ac = WebGUI::AdminConsole->new; + $ac->setAdminFunction("activeSessions"); + return $ac->render($output); +} + +1; diff --git a/lib/WebGUI/Operation/Admin.pm b/lib/WebGUI/Operation/Admin.pm index e614c45f6..4146a2aae 100644 --- a/lib/WebGUI/Operation/Admin.pm +++ b/lib/WebGUI/Operation/Admin.pm @@ -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)); diff --git a/lib/WebGUI/Operation/Clipboard.pm b/lib/WebGUI/Operation/Clipboard.pm index d46c1ad32..3f111cc0c 100644 --- a/lib/WebGUI/Operation/Clipboard.pm +++ b/lib/WebGUI/Operation/Clipboard.pm @@ -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 .= '

'.WebGUI::International::get(42).'

'; $output .= WebGUI::International::get(956).'

'; if ($session{form}{wid} ne "") { $output .= '

' .WebGUI::International::get(45).'
'; - 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 .= '

'.WebGUI::International::get(42).'

'; $output .= WebGUI::International::get(951).'

'; if ( ($session{setting}{sharedClipboard} ne "1") && (WebGUI::Grouping::isInGroup(3)) ) { $output .= '

'.WebGUI::International::get(44).''; } - $output .= '    ' + $output .= '    ' .WebGUI::International::get(45).'
'; - 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 .= '

'. WebGUI::International::get(948) .'

'; } elsif ($session{form}{systemClipboard} eq "1") { return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3)); $allUsers = 1; - $output .= '

'. WebGUI::International::get(955) .'

'; + $title = '955'; } else { $allUsers = 0; - $output .= '

'. WebGUI::International::get(948) .'

'; } # Generate list of pages in clipboard @@ -331,7 +335,7 @@ sub www_manageClipboard { $output .= $p->getPage($session{form}{pn}); $output .= ''; $output .= $p->getBarTraditional($session{form}{pn}); - return _submenu($output); + return _submenu($output, $title, "clipboard manage"); } 1; diff --git a/lib/WebGUI/Operation/DatabaseLink.pm b/lib/WebGUI/Operation/DatabaseLink.pm index e6833514a..eb68364a5 100644 --- a/lib/WebGUI/Operation/DatabaseLink.pm +++ b/lib/WebGUI/Operation/DatabaseLink.pm @@ -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 .= '

'.WebGUI::International::get(987).'

'; $output .= WebGUI::International::get(988).'

'; foreach my $using (WebGUI::DatabaseLink::whatIsUsing($session{form}{dlid})) { if ($using->{title}) { @@ -69,7 +74,7 @@ sub www_deleteDatabaseLink { .'">'.WebGUI::International::get(44).''; $output .= '    '.WebGUI::International::get(45).''; - 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 .= '

'.WebGUI::International::get(990).'

'; $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 .= '

'.WebGUI::International::get(996).'

'; $sth = WebGUI::SQL->read("select * from databaseLink order by title"); $row[$i] = ''.WebGUI::International::get(1076).''; $i++; @@ -141,7 +142,7 @@ sub www_listDatabaseLinks { $output .= $p->getPage; $output .= ''; $output .= $p->getBarTraditional; - return _submenu($output); + return _submenu($output,"database links manage"); } diff --git a/lib/WebGUI/Operation/LoginHistory.pm b/lib/WebGUI/Operation/LoginHistory.pm new file mode 100644 index 000000000..0b01f5046 --- /dev/null +++ b/lib/WebGUI/Operation/LoginHistory.pm @@ -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] = ''.$data{username}.' ('.$data{userId}.')'; + $row[$i] .= ''.$data{status}.''; + $row[$i] .= ''.epochToHuman($data{timeStamp},"%H:%n%p %M/%D/%y").''; + $row[$i] .= ''.$data{ipAddress}.''; + $row[$i] .= ''.$data{userAgent}.''; + $i++; + } + $sth->finish; + $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory')); + $p->setDataByArrayRef(\@row); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= $p->getPage($session{form}{pn}); + $output .= '
'.WebGUI::International::get(428).''.WebGUI::International::get(434).''.WebGUI::International::get(429).''.WebGUI::International::get(431).''.WebGUI::International::get(433).'
'; + $output .= $p->getBar($session{form}{pn}); + my $ac = WebGUI::AdminConsole->new; + $ac->setAdminFunction("loginHistory"); + return $ac->render($output); +} + +1; diff --git a/lib/WebGUI/Operation/Statistics.pm b/lib/WebGUI/Operation/Statistics.pm index ee4115e11..edce23224 100644 --- a/lib/WebGUI/Operation/Statistics.pm +++ b/lib/WebGUI/Operation/Statistics.pm @@ -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 = '

'.WebGUI::International::get(425).'

'; - $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] = ''.$data{username}.' ('.$data{userId}.')'; - $row[$i] .= ''.$data{sessionId}.''; - $row[$i] .= ''.epochToHuman($data{expires}).''; - $row[$i] .= ''.epochToHuman($data{lastPageView}).''; - $row[$i] .= ''.$data{lastIP}.''; - $row[$i] .= ''.deleteIcon("op=killSession&sid=$data{sessionId}").''; - $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 .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - $output .= $p->getPage($session{form}{pn}); - $output .= '
'.WebGUI::International::get(428).''.WebGUI::International::get(435).''.WebGUI::International::get(432).''.WebGUI::International::get(430).''.WebGUI::International::get(431).''.WebGUI::International::get(436).'
'; - $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 = '

'.WebGUI::International::get(426).'

'; - $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] = ''.$data{username}.' ('.$data{userId}.')'; - $row[$i] .= ''.$data{status}.''; - $row[$i] .= ''.epochToHuman($data{timeStamp},"%H:%n%p %M/%D/%y").''; - $row[$i] .= ''.$data{ipAddress}.''; - $row[$i] .= ''.$data{userAgent}.''; - $i++; - } - $sth->finish; - $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory')); - $p->setDataByArrayRef(\@row); - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - $output .= $p->getPage($session{form}{pn}); - $output .= '
'.WebGUI::International::get(428).''.WebGUI::International::get(434).''.WebGUI::International::get(429).''.WebGUI::International::get(431).''.WebGUI::International::get(433).'
'; - $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 = '

Page Statistics

'; unless ($session{setting}{trackPageStatistics}) { $output .= WebGUI::International::get(802); } else { @@ -146,7 +73,7 @@ sub www_viewPageReport { } $output .= ''; } - return _submenu($output); + return _submenu($output,"page statistics"); } #------------------------------------------------------------------- @@ -160,9 +87,8 @@ sub www_viewStatistics { $version = $cache->setByHTTP($url,43200); } chomp $version; - $output .= '

'.WebGUI::International::get(437).'

'; $output .= ''; - $output .= ''; + $output .= ''; if ($version ne $WebGUI::VERSION) { my @rev = split(/\./,$version); diff --git a/lib/WebGUI/i18n/English/AdminConsole.pm b/lib/WebGUI/i18n/English/AdminConsole.pm new file mode 100644 index 000000000..edb25480c --- /dev/null +++ b/lib/WebGUI/i18n/English/AdminConsole.pm @@ -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; diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm new file mode 100644 index 000000000..98de2038f --- /dev/null +++ b/lib/WebGUI/i18n/English/Asset.pm @@ -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; diff --git a/lib/WebGUI/i18n/English/MetaData.pm b/lib/WebGUI/i18n/English/MetaData.pm index 059dfdc7c..89b790c8c 100644 --- a/lib/WebGUI/i18n/English/MetaData.pm +++ b/lib/WebGUI/i18n/English/MetaData.pm @@ -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; diff --git a/lib/WebGUI/i18n/English/Navigation.pm b/lib/WebGUI/i18n/English/Navigation.pm index 890ec5e34..ae3089fc7 100644 --- a/lib/WebGUI/i18n/English/Navigation.pm +++ b/lib/WebGUI/i18n/English/Navigation.pm @@ -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; diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 721520045..c3ae22c6c 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -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.

@@ -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.

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; diff --git a/www/extras/adminConsole/adminConsole.css b/www/extras/adminConsole/adminConsole.css new file mode 100644 index 000000000..41ac7eed9 --- /dev/null +++ b/www/extras/adminConsole/adminConsole.css @@ -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; +} diff --git a/www/extras/adminConsole/adminConsole.js b/www/extras/adminConsole/adminConsole.js new file mode 100644 index 000000000..9056e4494 --- /dev/null +++ b/www/extras/adminConsole/adminConsole.js @@ -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(); + } +} + +
'.WebGUI::International::get(145).':'.$WebGUI::VERSION.'
'.WebGUI::International::get(145).':'.$WebGUI::VERSION.'-'.$WebGUI::STATUS.'