Cleaning up the administrative UI.
This commit is contained in:
parent
e8bab4e22b
commit
ca32410535
6 changed files with 489 additions and 588 deletions
|
|
@ -101,6 +101,38 @@ delete from international where namespace='WebGUI' and internationalId=631;
|
|||
delete from help where namespace='WebGUI' and helpId=26;
|
||||
delete from help where namespace='WebGUI' and helpId=23;
|
||||
delete from help where namespace='WebGUI' and helpId=36;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (790,1,'WebGUI','Delete this profile category.', 1036964807);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (789,1,'WebGUI','Edit this profile category.', 1036964795);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (788,1,'WebGUI','Delete this profile field.', 1036964681);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (787,1,'WebGUI','Edit this profile field.', 1036964659);
|
||||
delete from settings where name='imageManagersGroup';
|
||||
delete from international where languageId=1 and namespace='WebGUI' and internationalId=586;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (586,1,'WebGUI','Manage Translations', 1036971445);
|
||||
delete from international where languageId=1 and namespace='WebGUI' and internationalId=589;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (589,1,'WebGUI','Edit Translation', 1036971172);
|
||||
delete from international where languageId=1 and namespace='WebGUI' and internationalId=598;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (598,1,'WebGUI','Edit this translation.', 1036971142);
|
||||
delete from international where languageId=1 and namespace='WebGUI' and internationalId=584;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (584,1,'WebGUI','Add a new translation.', 1036971092);
|
||||
delete from international where languageId=1 and namespace='WebGUI' and internationalId=718;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (718,1,'WebGUI','Export this translation.', 1036970877);
|
||||
delete from international where languageId=1 and namespace='WebGUI' and internationalId=593;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (593,1,'WebGUI','Submit this translation.', 1036970850);
|
||||
delete from international where languageId=1 and namespace='WebGUI' and internationalId=791;
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (791,1,'WebGUI','Delete this translation.', 1036970806);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (802,1,'WebGUI','WebGUI is not currently tracking page statistics. You can enable this feature in the settings.', 1036979395);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (801,1,'WebGUI','Wobject Interactions', 1036978843);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (800,1,'WebGUI','Unique Visitors', 1036978829);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (799,1,'WebGUI','Page Views', 1036978804);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (798,1,'WebGUI','Page Title', 1036978688);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (797,1,'WebGUI','View traffic statistics.', 1036978191);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (796,1,'WebGUI','View page statistics.', 1036978043);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (795,1,'WebGUI','Roots', 1036972103);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (794,1,'WebGUI','Packages', 1036971944);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (793,1,'WebGUI','Pieces of Collateral', 1036971785);
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (792,1,'WebGUI','Templates', 1036971696);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ sub _processOperations {
|
|||
if ($session{form}{op} =~ /^[A-Za-z]+$/) {
|
||||
$cmd = "WebGUI::Operation::www_".$session{form}{op};
|
||||
$output = eval($cmd);
|
||||
WebGUI::ErrorHandler::security("call a non-existent operation: $session{form}{op}.") if($@);
|
||||
WebGUI::ErrorHandler::security("call a non-existent operation: $session{form}{op}. Root cause: ".$@) if($@);
|
||||
} else {
|
||||
WebGUI::ErrorHandler::security("execute an invalid operation: ".$session{form}{op});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,15 +58,17 @@ sub _export {
|
|||
sub _submenu {
|
||||
my (%menu);
|
||||
tie %menu, 'Tie::IxHash';
|
||||
$menu{WebGUI::URL::page('op=editLanguage&lid=new')} = WebGUI::International::get(584);
|
||||
if ($session{form}{lid} == 1) {
|
||||
$menu{WebGUI::URL::page('op=addInternationalMessage&lid=1')} = "Add new message.";
|
||||
$menu{WebGUI::URL::page('op=addInternationalMessage&lid=1')} = "Add a new message.";
|
||||
}
|
||||
if ($session{form}{lid} ne "") {
|
||||
if ($session{form}{lid} ne "new" && $session{form}{lid} ne "") {
|
||||
$menu{WebGUI::URL::page('op=listInternationalMessages&lid='.$session{form}{lid})} =
|
||||
WebGUI::International::get(594);
|
||||
$menu{WebGUI::URL::page('op=editLanguage&lid='.$session{form}{lid})} = WebGUI::International::get(598);
|
||||
$menu{WebGUI::URL::page('op=exportTranslation&lid='.$session{form}{lid})} = WebGUI::International::get(718);
|
||||
$menu{WebGUI::URL::page('op=submitTranslation&lid='.$session{form}{lid})} = WebGUI::International::get(593);
|
||||
$menu{WebGUI::URL::page('op=editLanguage&lid='.$session{form}{lid})} = WebGUI::International::get(598);
|
||||
$menu{WebGUI::URL::page("op=deleteLanguage&lid=".$session{form}{lid})} = WebGUI::International::get(791);
|
||||
}
|
||||
$menu{WebGUI::URL::page('op=listLanguages')} = WebGUI::International::get(585);
|
||||
return menuWrapper($_[0],\%menu);
|
||||
|
|
@ -103,20 +105,16 @@ sub www_addInternationalMessageSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteLanguage {
|
||||
my ($output);
|
||||
if ($session{form}{lid} < 1000 && $session{form}{lid} > 0) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(587).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
WebGUI::URL::page('op=deleteLanguageConfirm&lid='.$session{form}{lid})
|
||||
.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=listLanguages').
|
||||
'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return WebGUI::Privilege::vitalComponent() if ($session{form}{lid} < 1000 && $session{form}{lid} > 0);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(587).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
WebGUI::URL::page('op=deleteLanguageConfirm&lid='.$session{form}{lid})
|
||||
.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=listLanguages').
|
||||
'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -125,8 +123,8 @@ sub www_deleteLanguageConfirm {
|
|||
return WebGUI::Privilege::vitalComponent() if ($session{form}{lid} < 1000 && $session{form}{lid} > 0);
|
||||
WebGUI::SQL->write("delete from language where languageId=".$session{form}{lid});
|
||||
WebGUI::SQL->write("delete from international where languageId=".$session{form}{lid});
|
||||
WebGUI::SQL->write("delete from help where languageId=".$session{form}{lid});
|
||||
WebGUI::SQL->write("delete from userProfileData where fieldName='language' and fieldData=".$session{form}{lid});
|
||||
$session{form}{lid} = "";
|
||||
return www_listLanguages();
|
||||
}
|
||||
|
||||
|
|
@ -308,13 +306,9 @@ sub www_listLanguages {
|
|||
tie %data, 'Tie::CPHash';
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
$output = '<h1>'.WebGUI::International::get(586).'</h1>';
|
||||
$output .= '<a href="'.WebGUI::URL::page('op=editLanguage&lid=new').'">'.WebGUI::International::get(584).'</a>';
|
||||
$output .= '<p>';
|
||||
$sth = WebGUI::SQL->read("select languageId,language from language where languageId<>1 order by language");
|
||||
while (%data = $sth->hash) {
|
||||
$output .= deleteIcon("op=deleteLanguage&lid=".$data{languageId})
|
||||
.editIcon("op=editLanguage&lid=".$data{languageId})
|
||||
.' '.$data{language}.'<br>';
|
||||
$output .= '<a href="'.WebGUI::URL::page("op=editLanguage&lid=".$data{languageId}).'">'.$data{language}.'<br>';
|
||||
}
|
||||
$sth->finish;
|
||||
return _submenu($output);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use Tie::IxHash;
|
|||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Operation::Shared;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -47,200 +48,177 @@ sub _reorderFields {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _subMenu {
|
||||
my ($output);
|
||||
$output = '<table width="100%"><tr><td class="tableData" valign="top">';
|
||||
$output .= $_[0];
|
||||
$output .= '</td><td class="tableMenu" valign="top">';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page("op=editProfileCategory").'">'.WebGUI::International::get(490).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page("op=editProfileField").'">'.WebGUI::International::get(491).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page("op=editProfileSettings").'">'.WebGUI::International::get(492).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(493).'</a>';
|
||||
$output .= '</td></tr></table>';
|
||||
return $output;
|
||||
sub _submenu {
|
||||
my (%menu);
|
||||
tie %menu, 'Tie::IxHash';
|
||||
$menu{WebGUI::URL::page("op=editProfileCategory")} = WebGUI::International::get(490);
|
||||
$menu{WebGUI::URL::page("op=editProfileField")} = WebGUI::International::get(491);
|
||||
if (($session{form}{op} eq "editProfileField" && $session{form}{fid} ne "new") || $session{form}{op} eq "deleteProfileField") {
|
||||
$menu{WebGUI::URL::page('op=editProfileField&fid='.$session{form}{fid})} = WebGUI::International::get(787);
|
||||
$menu{WebGUI::URL::page('op=deleteProfileField&fid='.$session{form}{fid})} = WebGUI::International::get(788);
|
||||
}
|
||||
if (($session{form}{op} eq "editProfileCategory" && $session{form}{cid} ne "new") || $session{form}{op} eq "deleteProfileCategory") {
|
||||
$menu{WebGUI::URL::page('op=editProfileCategory&cid='.$session{form}{cid})} = WebGUI::International::get(789);
|
||||
$menu{WebGUI::URL::page('op=deleteProfileCategory&cid='.$session{form}{cid})} = WebGUI::International::get(790);
|
||||
}
|
||||
$menu{WebGUI::URL::page("op=editProfileSettings")} = WebGUI::International::get(492);
|
||||
$menu{WebGUI::URL::page('op=manageSettings')} = WebGUI::International::get(4);
|
||||
return menuWrapper($_[0],\%menu);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileCategory {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output);
|
||||
if ($session{form}{cid} < 100) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(466).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
WebGUI::URL::page('op=deleteProfileCategoryConfirm&cid='.$session{form}{cid}).
|
||||
'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.
|
||||
WebGUI::International::get(45).'</a></div>';
|
||||
return _subMenu($output);
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return WebGUI::Privilege::vitalComponent() if ($session{form}{cid} < 1000);
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(466).'<p>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deleteProfileCategoryConfirm&cid='.$session{form}{cid}).
|
||||
'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.
|
||||
WebGUI::International::get(45).'</a></div>';
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileCategoryConfirm {
|
||||
if ($session{form}{cid} < 100) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
WebGUI::SQL->write("update userProfileField set profileCategoryId=1 where profileCategoryId=$session{form}{cid}");
|
||||
return www_editProfileSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
return WebGUI::Privilege::vitalComponent() if ($session{form}{cid} < 1000);
|
||||
WebGUI::SQL->write("delete from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
WebGUI::SQL->write("update userProfileField set profileCategoryId=1 where profileCategoryId=$session{form}{cid}");
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileField {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output,$protected);
|
||||
($protected) = WebGUI::SQL->quickArray("select protected from userProfileField where fieldname=".quote($session{form}{fid}));
|
||||
if ($protected) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(467).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
WebGUI::URL::page('op=deleteProfileFieldConfirm&fid='.$session{form}{fid}).
|
||||
'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.
|
||||
WebGUI::International::get(45).'</a></div>';
|
||||
return _subMenu($output);
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return WebGUI::Privilege::vitalComponent() if ($protected);
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(467).'<p>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deleteProfileFieldConfirm&fid='.$session{form}{fid}).
|
||||
'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.
|
||||
WebGUI::International::get(45).'</a></div>';
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileFieldConfirm {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($protected);
|
||||
($protected) = WebGUI::SQL->quickArray("select protected from userProfileField where fieldname=".quote($session{form}{fid}));
|
||||
if ($protected) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
WebGUI::SQL->write("delete from userProfileData where fieldName=".quote($session{form}{fid}));
|
||||
return www_editProfileSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return WebGUI::Privilege::vitalComponent() if ($protected);
|
||||
WebGUI::SQL->write("delete from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
WebGUI::SQL->write("delete from userProfileData where fieldName=".quote($session{form}{fid}));
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileCategory {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $f, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<h1>'.WebGUI::International::get(468).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editProfileCategorySave");
|
||||
if ($session{form}{cid}) {
|
||||
$f->hidden("cid",$session{form}{cid});
|
||||
$f->readOnly($session{form}{cid},WebGUI::International::get(469));
|
||||
%data = WebGUI::SQL->quickHash("select * from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
} else {
|
||||
$f->hidden("cid","new");
|
||||
}
|
||||
$f->text("categoryName",WebGUI::International::get(470),$data{categoryName});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _subMenu($output);
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$output = '<h1>'.WebGUI::International::get(468).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editProfileCategorySave");
|
||||
if ($session{form}{cid}) {
|
||||
$f->hidden("cid",$session{form}{cid});
|
||||
$f->readOnly($session{form}{cid},WebGUI::International::get(469));
|
||||
%data = WebGUI::SQL->quickHash("select * from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
} else {
|
||||
$f->hidden("cid","new");
|
||||
}
|
||||
$f->text("categoryName",WebGUI::International::get(470),$data{categoryName});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileCategorySave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($categoryId, $sequenceNumber, $test);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$session{form}{categoryName} = 'Unamed' if ($session{form}{categoryName} eq "" || $session{form}{categoryName} eq "''");
|
||||
$test = eval($session{form}{categoryName});
|
||||
$session{form}{categoryName} = "'".$session{form}{categoryName}."'" if ($test eq "");
|
||||
if ($session{form}{cid} eq "new") {
|
||||
$categoryId = getNextId("profileCategoryId");
|
||||
($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber) from userProfileCategory");
|
||||
WebGUI::SQL->write("insert into userProfileCategory values ($categoryId, ".quote($session{form}{categoryName}).",
|
||||
".($sequenceNumber+1).")");
|
||||
} else {
|
||||
WebGUI::SQL->write("update userProfileCategory set categoryName=".quote($session{form}{categoryName})." where
|
||||
profileCategoryId=$session{form}{cid}");
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
return $test;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$session{form}{categoryName} = 'Unamed' if ($session{form}{categoryName} eq "" || $session{form}{categoryName} eq "''");
|
||||
$test = eval($session{form}{categoryName});
|
||||
$session{form}{categoryName} = "'".$session{form}{categoryName}."'" if ($test eq "");
|
||||
if ($session{form}{cid} eq "new") {
|
||||
$categoryId = getNextId("profileCategoryId");
|
||||
($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber) from userProfileCategory");
|
||||
WebGUI::SQL->write("insert into userProfileCategory values ($categoryId, ".quote($session{form}{categoryName}).",
|
||||
".($sequenceNumber+1).")");
|
||||
} else {
|
||||
WebGUI::SQL->write("update userProfileCategory set categoryName=".quote($session{form}{categoryName})." where
|
||||
profileCategoryId=$session{form}{cid}");
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileField {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $f, %data, %hash, $key);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<h1>'.WebGUI::International::get(471).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editProfileFieldSave");
|
||||
if ($session{form}{fid}) {
|
||||
$f->hidden("fid",$session{form}{fid});
|
||||
$f->readOnly($session{form}{fid},WebGUI::International::get(470));
|
||||
%data = WebGUI::SQL->quickHash("select * from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
} else {
|
||||
$f->hidden("new",1);
|
||||
$f->text("fid",WebGUI::International::get(470));
|
||||
}
|
||||
$f->text("fieldLabel",WebGUI::International::get(472),$data{fieldLabel});
|
||||
$f->yesNo("visible",WebGUI::International::get(473),$data{visible});
|
||||
$f->yesNo("required",WebGUI::International::get(474),$data{required});
|
||||
tie %hash, 'Tie::IxHash';
|
||||
%hash = ( 'text'=>WebGUI::International::get(475),
|
||||
'textarea'=>WebGUI::International::get(476),
|
||||
'HTMLArea'=>WebGUI::International::get(477),
|
||||
'url'=>WebGUI::International::get(478),
|
||||
'date'=>WebGUI::International::get(479),
|
||||
'email'=>WebGUI::International::get(480),
|
||||
'phone'=>WebGUI::International::get(481),
|
||||
'integer'=>WebGUI::International::get(482),
|
||||
'yesNo'=>WebGUI::International::get(483),
|
||||
'select'=>WebGUI::International::get(484)
|
||||
);
|
||||
$f->select("dataType",\%hash,WebGUI::International::get(486),[$data{dataType}]);
|
||||
$f->textarea("dataValues",WebGUI::International::get(487),$data{dataValues});
|
||||
$f->textarea("dataDefault",WebGUI::International::get(488),$data{dataDefault});
|
||||
tie %hash, 'Tie::CPHash';
|
||||
%hash = WebGUI::SQL->buildHash("select profileCategoryId,categoryName from userProfileCategory order by categoryName");
|
||||
foreach $key (keys %hash) {
|
||||
$hash{$key} = eval $hash{$key};
|
||||
}
|
||||
$f->select("profileCategoryId",\%hash,WebGUI::International::get(489),[$data{profileCategoryId}]);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _subMenu($output);
|
||||
$output = '<h1>'.WebGUI::International::get(471).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editProfileFieldSave");
|
||||
if ($session{form}{fid}) {
|
||||
$f->hidden("fid",$session{form}{fid});
|
||||
$f->readOnly($session{form}{fid},WebGUI::International::get(470));
|
||||
%data = WebGUI::SQL->quickHash("select * from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$f->hidden("new",1);
|
||||
$f->text("fid",WebGUI::International::get(470));
|
||||
}
|
||||
$f->text("fieldLabel",WebGUI::International::get(472),$data{fieldLabel});
|
||||
$f->yesNo("visible",WebGUI::International::get(473),$data{visible});
|
||||
$f->yesNo("required",WebGUI::International::get(474),$data{required});
|
||||
tie %hash, 'Tie::IxHash';
|
||||
%hash = ( 'text'=>WebGUI::International::get(475),
|
||||
'textarea'=>WebGUI::International::get(476),
|
||||
'HTMLArea'=>WebGUI::International::get(477),
|
||||
'url'=>WebGUI::International::get(478),
|
||||
'date'=>WebGUI::International::get(479),
|
||||
'email'=>WebGUI::International::get(480),
|
||||
'phone'=>WebGUI::International::get(481),
|
||||
'integer'=>WebGUI::International::get(482),
|
||||
'yesNo'=>WebGUI::International::get(483),
|
||||
'select'=>WebGUI::International::get(484)
|
||||
);
|
||||
$f->select("dataType",\%hash,WebGUI::International::get(486),[$data{dataType}]);
|
||||
$f->textarea("dataValues",WebGUI::International::get(487),$data{dataValues});
|
||||
$f->textarea("dataDefault",WebGUI::International::get(488),$data{dataDefault});
|
||||
tie %hash, 'Tie::CPHash';
|
||||
%hash = WebGUI::SQL->buildHash("select profileCategoryId,categoryName from userProfileCategory order by categoryName");
|
||||
foreach $key (keys %hash) {
|
||||
$hash{$key} = eval $hash{$key};
|
||||
}
|
||||
$f->select("profileCategoryId",\%hash,WebGUI::International::get(489),[$data{profileCategoryId}]);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileFieldSave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($sequenceNumber, $fieldName, $test);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$session{form}{fieldLabel} = 'Unamed' if ($session{form}{fieldLabel} eq "" || $session{form}{fieldLabel} eq "''");
|
||||
$test = eval($session{form}{fieldLabel});
|
||||
$session{form}{fieldLabel} = "'".$session{form}{fieldLabel}."'" if ($test eq "");
|
||||
if ($session{form}{new}) {
|
||||
($fieldName) = WebGUI::SQL->quickArray("select count(*) from userProfileField
|
||||
where fieldName=".quote($session{form}{fid}));
|
||||
if ($fieldName) {
|
||||
$session{form}{fid} .= '2';
|
||||
}
|
||||
($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber)
|
||||
from userProfileField where profileCategoryId=$session{form}{profileCategoryId}");
|
||||
WebGUI::SQL->write("insert into userProfileField (fieldName, sequenceNumber, protected)
|
||||
values (".quote($session{form}{fid}).", ".($sequenceNumber+1).", 0)");
|
||||
$session{form}{fieldLabel} = 'Unamed' if ($session{form}{fieldLabel} eq "" || $session{form}{fieldLabel} eq "''");
|
||||
$test = eval($session{form}{fieldLabel});
|
||||
$session{form}{fieldLabel} = "'".$session{form}{fieldLabel}."'" if ($test eq "");
|
||||
if ($session{form}{new}) {
|
||||
($fieldName) = WebGUI::SQL->quickArray("select count(*) from userProfileField
|
||||
where fieldName=".quote($session{form}{fid}));
|
||||
if ($fieldName) {
|
||||
$session{form}{fid} .= '2';
|
||||
}
|
||||
WebGUI::SQL->write("update userProfileField set
|
||||
($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber)
|
||||
from userProfileField where profileCategoryId=$session{form}{profileCategoryId}");
|
||||
WebGUI::SQL->write("insert into userProfileField (fieldName, sequenceNumber, protected)
|
||||
values (".quote($session{form}{fid}).", ".($sequenceNumber+1).", 0)");
|
||||
}
|
||||
WebGUI::SQL->write("update userProfileField set
|
||||
fieldLabel=".quote($session{form}{fieldLabel}).",
|
||||
visible='$session{form}{visible}',
|
||||
required='$session{form}{required}',
|
||||
|
|
@ -249,116 +227,98 @@ sub www_editProfileFieldSave {
|
|||
dataDefault=".quote($session{form}{dataDefault}).",
|
||||
profileCategoryId=".quote($session{form}{profileCategoryId})."
|
||||
where fieldName=".quote($session{form}{fid}));
|
||||
return www_editProfileSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileSettings {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $a, %category, %field, $b);
|
||||
tie %category, 'Tie::CPHash';
|
||||
tie %field, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = helpIcon(22);
|
||||
$output .= '<h1>'.WebGUI::International::get(308).'</h1>';
|
||||
$a = WebGUI::SQL->read("select * from userProfileCategory order by sequenceNumber");
|
||||
while (%category = $a->hash) {
|
||||
$output .= deleteIcon('op=deleteProfileCategory&cid='.$category{profileCategoryId});
|
||||
$output .= editIcon('op=editProfileCategory&cid='.$category{profileCategoryId});
|
||||
$output .= moveUpIcon('op=moveProfileCategoryUp&cid='.$category{profileCategoryId});
|
||||
$output .= moveDownIcon('op=moveProfileCategoryDown&cid='.$category{profileCategoryId});
|
||||
$output .= ' <b>';
|
||||
$output .= eval $category{categoryName};
|
||||
$output .= '</b><br>';
|
||||
$b = WebGUI::SQL->read("select * from userProfileField where
|
||||
profileCategoryId=$category{profileCategoryId} order by sequenceNumber");
|
||||
while (%field = $b->hash) {
|
||||
$output .= ' ';
|
||||
$output .= deleteIcon('op=deleteProfileField&fid='.$field{fieldName});
|
||||
$output .= editIcon('op=editProfileField&fid='.$field{fieldName});
|
||||
$output .= moveUpIcon('op=moveProfileFieldUp&fid='.$field{fieldName});
|
||||
$output .= moveDownIcon('op=moveProfileFieldDown&fid='.$field{fieldName});
|
||||
$output .= ' ';
|
||||
$output .= eval $field{fieldLabel};
|
||||
$output .= '<br>';
|
||||
}
|
||||
$b->finish;
|
||||
$output = helpIcon(22);
|
||||
$output .= '<h1>'.WebGUI::International::get(308).'</h1>';
|
||||
$a = WebGUI::SQL->read("select * from userProfileCategory order by sequenceNumber");
|
||||
while (%category = $a->hash) {
|
||||
$output .= deleteIcon('op=deleteProfileCategory&cid='.$category{profileCategoryId});
|
||||
$output .= editIcon('op=editProfileCategory&cid='.$category{profileCategoryId});
|
||||
$output .= moveUpIcon('op=moveProfileCategoryUp&cid='.$category{profileCategoryId});
|
||||
$output .= moveDownIcon('op=moveProfileCategoryDown&cid='.$category{profileCategoryId});
|
||||
$output .= ' <b>';
|
||||
$output .= eval $category{categoryName};
|
||||
$output .= '</b><br>';
|
||||
$b = WebGUI::SQL->read("select * from userProfileField where
|
||||
profileCategoryId=$category{profileCategoryId} order by sequenceNumber");
|
||||
while (%field = $b->hash) {
|
||||
$output .= ' ';
|
||||
$output .= deleteIcon('op=deleteProfileField&fid='.$field{fieldName});
|
||||
$output .= editIcon('op=editProfileField&fid='.$field{fieldName});
|
||||
$output .= moveUpIcon('op=moveProfileFieldUp&fid='.$field{fieldName});
|
||||
$output .= moveDownIcon('op=moveProfileFieldDown&fid='.$field{fieldName});
|
||||
$output .= ' ';
|
||||
$output .= eval $field{fieldLabel};
|
||||
$output .= '<br>';
|
||||
}
|
||||
$a->finish;
|
||||
return _subMenu($output);
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
$b->finish;
|
||||
}
|
||||
$a->finish;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileCategoryDown {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($id, $thisSeq);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
($id) = WebGUI::SQL->quickArray("select profileCategoryId from userProfileCategory where sequenceNumber=$thisSeq+1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber+1 where profileCategoryId=$session{form}{cid}");
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber-1 where profileCategoryId=$id");
|
||||
_reorderCategories();
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
($id) = WebGUI::SQL->quickArray("select profileCategoryId from userProfileCategory where sequenceNumber=$thisSeq+1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber+1 where profileCategoryId=$session{form}{cid}");
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber-1 where profileCategoryId=$id");
|
||||
_reorderCategories();
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileCategoryUp {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($id, $thisSeq);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
($id) = WebGUI::SQL->quickArray("select profileCategoryId from userProfileCategory where sequenceNumber=$thisSeq-1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber-1 where profileCategoryId=$session{form}{cid}");
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber+1 where profileCategoryId=$id");
|
||||
_reorderCategories();
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from userProfileCategory where profileCategoryId=$session{form}{cid}");
|
||||
($id) = WebGUI::SQL->quickArray("select profileCategoryId from userProfileCategory where sequenceNumber=$thisSeq-1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber-1 where profileCategoryId=$session{form}{cid}");
|
||||
WebGUI::SQL->write("update userProfileCategory set sequenceNumber=sequenceNumber+1 where profileCategoryId=$id");
|
||||
_reorderCategories();
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileFieldDown {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($id, $thisSeq, $profileCategoryId);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
($thisSeq,$profileCategoryId) = WebGUI::SQL->quickArray("select sequenceNumber,profileCategoryId from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
($id) = WebGUI::SQL->quickArray("select fieldName from userProfileField where profileCategoryId=$profileCategoryId and sequenceNumber=$thisSeq+1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber+1 where fieldName=".quote($session{form}{fid}));
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber-1 where fieldName=".quote($id));
|
||||
_reorderFields($profileCategoryId);
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
($thisSeq,$profileCategoryId) = WebGUI::SQL->quickArray("select sequenceNumber,profileCategoryId from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
($id) = WebGUI::SQL->quickArray("select fieldName from userProfileField where profileCategoryId=$profileCategoryId and sequenceNumber=$thisSeq+1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber+1 where fieldName=".quote($session{form}{fid}));
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber-1 where fieldName=".quote($id));
|
||||
_reorderFields($profileCategoryId);
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileFieldUp {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($id, $thisSeq, $profileCategoryId);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
($thisSeq,$profileCategoryId) = WebGUI::SQL->quickArray("select sequenceNumber,profileCategoryId from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
($id) = WebGUI::SQL->quickArray("select fieldName from userProfileField where profileCategoryId=$profileCategoryId and sequenceNumber=$thisSeq-1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber-1 where fieldName=".quote($session{form}{fid}));
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber+1 where fieldName=".quote($id));
|
||||
_reorderFields($profileCategoryId);
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
($thisSeq,$profileCategoryId) = WebGUI::SQL->quickArray("select sequenceNumber,profileCategoryId from userProfileField where fieldName=".quote($session{form}{fid}));
|
||||
($id) = WebGUI::SQL->quickArray("select fieldName from userProfileField where profileCategoryId=$profileCategoryId and sequenceNumber=$thisSeq-1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber-1 where fieldName=".quote($session{form}{fid}));
|
||||
WebGUI::SQL->write("update userProfileField set sequenceNumber=sequenceNumber+1 where fieldName=".quote($id));
|
||||
_reorderFields($profileCategoryId);
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,274 +16,172 @@ use WebGUI::DateTime;
|
|||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Operation::Shared;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_editUserSettings &www_editUserSettingsSave &www_editCompanyInformation
|
||||
&www_editCompanyInformationSave &www_editPrivilegeSettings &www_editPrivilegeSettingsSave
|
||||
&www_editMailSettings &www_editMailSettingsSave &www_editMiscSettings
|
||||
&www_editContentSettings &www_editContentSettingsSave &www_editMiscSettingsSave &www_manageSettings);
|
||||
our @EXPORT = qw(&www_saveSettings &www_editUserSettings &www_editCompanyInformation
|
||||
&www_editPrivilegeSettings &www_editMailSettings &www_editMiscSettings
|
||||
&www_editContentSettings &www_manageSettings);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _saveSetting {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{$_[0]})." where name='$_[0]'");
|
||||
sub _submenu {
|
||||
my (%menu);
|
||||
tie %menu, 'Tie::IxHash';
|
||||
$menu{WebGUI::URL::page('op=manageSettings')} = WebGUI::International::get(4);
|
||||
return menuWrapper($_[0],\%menu);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUserSettings {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, %authMethod, $f);
|
||||
%authMethod = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpIcon(2);
|
||||
$output .= '<h1>'.WebGUI::International::get(117).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editUserSettingsSave");
|
||||
$f->yesNo("anonymousRegistration",WebGUI::International::get(118),$session{setting}{anonymousRegistration});
|
||||
$f->text("runOnRegistration",WebGUI::International::get(559),$session{setting}{runOnRegistration});
|
||||
$f->yesNo("alertOnNewUser",WebGUI::International::get(534),$session{setting}{alertOnNewUser});
|
||||
$f->group("onNewUserAlertGroup",WebGUI::International::get(535),[$session{setting}{onNewUserAlertGroup}]);
|
||||
$f->yesNo("useKarma",WebGUI::International::get(539),$session{setting}{useKarma});
|
||||
$f->integer("karmaPerLogin",WebGUI::International::get(540),$session{setting}{karmaPerLogin});
|
||||
$f->interval("sessionTimeout",WebGUI::International::get(142),WebGUI::DateTime::secondsToInterval($session{setting}{sessionTimeout}));
|
||||
$f->select("authMethod",\%authMethod,WebGUI::International::get(119),[$session{setting}{authMethod}]);
|
||||
$f->yesNo("usernameBinding",WebGUI::International::get(306),$session{setting}{usernameBinding});
|
||||
$f->url("ldapURL",WebGUI::International::get(120),$session{setting}{ldapURL});
|
||||
$f->text("ldapId",WebGUI::International::get(121),$session{setting}{ldapId});
|
||||
$f->text("ldapIdName",WebGUI::International::get(122),$session{setting}{ldapIdName});
|
||||
$f->text("ldapPasswordName",WebGUI::International::get(123),$session{setting}{ldapPasswordName});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUserSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$session{form}{sessionTimeout} = WebGUI::DateTime::intervalToSeconds($session{form}{sessionTimeout_interval},
|
||||
$session{form}{sessionTimeout_units});
|
||||
_saveSetting("sessionTimeout");
|
||||
_saveSetting("onNewUserAlertGroup");
|
||||
_saveSetting("alertOnNewUser");
|
||||
_saveSetting("authMethod");
|
||||
_saveSetting("useKarma");
|
||||
_saveSetting("karmaPerLogin");
|
||||
_saveSetting("ldapURL");
|
||||
_saveSetting("ldapId");
|
||||
_saveSetting("ldapIdName");
|
||||
_saveSetting("ldapPasswordName");
|
||||
_saveSetting("anonymousRegistration");
|
||||
_saveSetting("usernameBinding");
|
||||
_saveSetting("runOnRegistration");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$output .= helpIcon(2);
|
||||
$output .= '<h1>'.WebGUI::International::get(117).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","saveSettings");
|
||||
$f->yesNo("anonymousRegistration",WebGUI::International::get(118),$session{setting}{anonymousRegistration});
|
||||
$f->text("runOnRegistration",WebGUI::International::get(559),$session{setting}{runOnRegistration});
|
||||
$f->yesNo("alertOnNewUser",WebGUI::International::get(534),$session{setting}{alertOnNewUser});
|
||||
$f->group("onNewUserAlertGroup",WebGUI::International::get(535),[$session{setting}{onNewUserAlertGroup}]);
|
||||
$f->yesNo("useKarma",WebGUI::International::get(539),$session{setting}{useKarma});
|
||||
$f->integer("karmaPerLogin",WebGUI::International::get(540),$session{setting}{karmaPerLogin});
|
||||
$f->interval("sessionTimeout",WebGUI::International::get(142),WebGUI::DateTime::secondsToInterval($session{setting}{sessionTimeout}));
|
||||
$f->select("authMethod",\%authMethod,WebGUI::International::get(119),[$session{setting}{authMethod}]);
|
||||
$f->yesNo("usernameBinding",WebGUI::International::get(306),$session{setting}{usernameBinding});
|
||||
$f->url("ldapURL",WebGUI::International::get(120),$session{setting}{ldapURL});
|
||||
$f->text("ldapId",WebGUI::International::get(121),$session{setting}{ldapId});
|
||||
$f->text("ldapIdName",WebGUI::International::get(122),$session{setting}{ldapIdName});
|
||||
$f->text("ldapPasswordName",WebGUI::International::get(123),$session{setting}{ldapPasswordName});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCompanyInformation {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $f);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpIcon(6);
|
||||
$output .= '<h1>'.WebGUI::International::get(124).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editCompanyInformationSave");
|
||||
$f->text("companyName",WebGUI::International::get(125),$session{setting}{companyName});
|
||||
$f->email("companyEmail",WebGUI::International::get(126),$session{setting}{companyEmail});
|
||||
$f->url("companyURL",WebGUI::International::get(127),$session{setting}{companyURL});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCompanyInformationSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
_saveSetting("companyName");
|
||||
_saveSetting("companyEmail");
|
||||
_saveSetting("companyURL");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$output .= helpIcon(6);
|
||||
$output .= '<h1>'.WebGUI::International::get(124).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","saveSettings");
|
||||
$f->text("companyName",WebGUI::International::get(125),$session{setting}{companyName});
|
||||
$f->email("companyEmail",WebGUI::International::get(126),$session{setting}{companyEmail});
|
||||
$f->url("companyURL",WebGUI::International::get(127),$session{setting}{companyURL});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editContentSettings {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, %htmlFilter, %editor, $f, $pages);
|
||||
$pages = WebGUI::SQL->buildHashRef("select pageId,menuTitle from page order by menuTitle");
|
||||
%htmlFilter = ('none'=>WebGUI::International::get(420), 'most'=>WebGUI::International::get(421),
|
||||
'javascript'=>WebGUI::International::get(526), 'all'=>WebGUI::International::get(419));
|
||||
%editor = ('built-in'=>WebGUI::International::get(495), 'edit-on-pro'=>WebGUI::International::get(494));
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpIcon(29);
|
||||
$output .= '<h1>'.WebGUI::International::get(525).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editContentSettingsSave");
|
||||
$f->select("defaultPage",$pages,WebGUI::International::get(527),[$session{setting}{defaultPage}]);
|
||||
$f->select("notFoundPage",$pages,WebGUI::International::get(141),[$session{setting}{notFoundPage}]);
|
||||
$f->text("docTypeDec",WebGUI::International::get(398),$session{setting}{docTypeDec});
|
||||
$f->yesNo("addEditStampToPosts",WebGUI::International::get(524),$session{setting}{addEditStampToPosts});
|
||||
$f->select("filterContributedHTML",\%htmlFilter,WebGUI::International::get(418),[$session{setting}{filterContributedHTML}]);
|
||||
$f->integer("maxAttachmentSize",WebGUI::International::get(130),$session{setting}{maxAttachmentSize});
|
||||
$f->integer("maxImageSize",WebGUI::International::get(583),$session{setting}{maxImageSize});
|
||||
$f->integer("thumbnailSize",WebGUI::International::get(406),$session{setting}{thumbnailSize});
|
||||
$f->integer("textAreaRows",WebGUI::International::get(463),$session{setting}{textAreaRows});
|
||||
$f->integer("textAreaCols",WebGUI::International::get(464),$session{setting}{textAreaCols});
|
||||
$f->integer("textBoxSize",WebGUI::International::get(465),$session{setting}{textBoxSize});
|
||||
$f->select("richEditor",\%editor,WebGUI::International::get(496),[$session{setting}{richEditor}]);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editContentSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
_saveSetting("groupToManageImages");
|
||||
_saveSetting("addEditStampToPosts");
|
||||
_saveSetting("defaultPage");
|
||||
_saveSetting("notFoundPage");
|
||||
_saveSetting("docTypeDec");
|
||||
_saveSetting("filterContributedHTML");
|
||||
_saveSetting("textAreaRows");
|
||||
_saveSetting("textAreaCols");
|
||||
_saveSetting("textBoxSize");
|
||||
_saveSetting("richEditor");
|
||||
_saveSetting("maxImageSize");
|
||||
_saveSetting("maxAttachmentSize");
|
||||
_saveSetting("thumbnailSize");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$output .= helpIcon(29);
|
||||
$output .= '<h1>'.WebGUI::International::get(525).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","saveSettings");
|
||||
$f->select("defaultPage",$pages,WebGUI::International::get(527),[$session{setting}{defaultPage}]);
|
||||
$f->select("notFoundPage",$pages,WebGUI::International::get(141),[$session{setting}{notFoundPage}]);
|
||||
$f->text("docTypeDec",WebGUI::International::get(398),$session{setting}{docTypeDec});
|
||||
$f->yesNo("addEditStampToPosts",WebGUI::International::get(524),$session{setting}{addEditStampToPosts});
|
||||
$f->select("filterContributedHTML",\%htmlFilter,WebGUI::International::get(418),[$session{setting}{filterContributedHTML}]);
|
||||
$f->integer("maxAttachmentSize",WebGUI::International::get(130),$session{setting}{maxAttachmentSize});
|
||||
$f->integer("maxImageSize",WebGUI::International::get(583),$session{setting}{maxImageSize});
|
||||
$f->integer("thumbnailSize",WebGUI::International::get(406),$session{setting}{thumbnailSize});
|
||||
$f->integer("textAreaRows",WebGUI::International::get(463),$session{setting}{textAreaRows});
|
||||
$f->integer("textAreaCols",WebGUI::International::get(464),$session{setting}{textAreaCols});
|
||||
$f->integer("textBoxSize",WebGUI::International::get(465),$session{setting}{textBoxSize});
|
||||
$f->select("richEditor",\%editor,WebGUI::International::get(496),[$session{setting}{richEditor}]);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMailSettings {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $f);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpIcon(13);
|
||||
$output .= '<h1>'.WebGUI::International::get(133).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editMailSettingsSave");
|
||||
$f->textarea("recoverPasswordEmail",WebGUI::International::get(134),$session{setting}{recoverPasswordEmail});
|
||||
$f->text("smtpServer",WebGUI::International::get(135),$session{setting}{smtpServer});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMailSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
_saveSetting("recoverPasswordEmail");
|
||||
_saveSetting("smtpServer");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$output .= helpIcon(13);
|
||||
$output .= '<h1>'.WebGUI::International::get(133).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","saveSettings");
|
||||
$f->textarea("recoverPasswordEmail",WebGUI::International::get(134),$session{setting}{recoverPasswordEmail});
|
||||
$f->text("smtpServer",WebGUI::International::get(135),$session{setting}{smtpServer});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMiscSettings {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $f);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpIcon(24);
|
||||
$output .= '<h1>'.WebGUI::International::get(140).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editMiscSettingsSave");
|
||||
$f->yesNo("preventProxyCache",WebGUI::International::get(400),$session{setting}{preventProxyCache});
|
||||
$f->yesNo("showDebug",WebGUI::International::get(707),$session{setting}{showDebug});
|
||||
$f->yesNo("trackPageStatistics",WebGUI::International::get(749),$session{setting}{trackPageStatistics});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMiscSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
_saveSetting("preventProxyCache");
|
||||
_saveSetting("showDebug");
|
||||
_saveSetting("trackPageStatistics");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$output .= helpIcon(24);
|
||||
$output .= '<h1>'.WebGUI::International::get(140).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","saveSettings");
|
||||
$f->yesNo("preventProxyCache",WebGUI::International::get(400),$session{setting}{preventProxyCache});
|
||||
$f->yesNo("showDebug",WebGUI::International::get(707),$session{setting}{showDebug});
|
||||
$f->yesNo("trackPageStatistics",WebGUI::International::get(749),$session{setting}{trackPageStatistics});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editPrivilegeSettings {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $f);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpIcon(48);
|
||||
$output .= '<h1>'.WebGUI::International::get(710).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editPrivilegeSettingsSave");
|
||||
$f->group("imageManagersGroup",WebGUI::International::get(711),[$session{setting}{imageManagersGroup}]);
|
||||
$f->group("styleManagersGroup",WebGUI::International::get(713),[$session{setting}{styleManagersGroup}]);
|
||||
$f->group("templateManagersGroup",WebGUI::International::get(714),[$session{setting}{templateManagersGroup}]);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editPrivilegeSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
_saveSetting("imageManagersGroup");
|
||||
_saveSetting("styleManagersGroup");
|
||||
_saveSetting("templateManagersGroup");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
$output .= helpIcon(48);
|
||||
$output .= '<h1>'.WebGUI::International::get(710).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","saveSettings");
|
||||
$f->group("styleManagersGroup",WebGUI::International::get(713),[$session{setting}{styleManagersGroup}]);
|
||||
$f->group("templateManagersGroup",WebGUI::International::get(714),[$session{setting}{templateManagersGroup}]);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_manageSettings {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpIcon(12);
|
||||
$output .= '<h1>'.WebGUI::International::get(143).'</h1>';
|
||||
$output .= '<ul>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editCompanyInformation').'">'.WebGUI::International::get(124).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editContentSettings').'">'.WebGUI::International::get(525).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editMailSettings').'">'.WebGUI::International::get(133).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editMiscSettings').'">'.WebGUI::International::get(140).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editPrivilegeSettings').'">'.WebGUI::International::get(710).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.WebGUI::International::get(308).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editUserSettings').'">'.WebGUI::International::get(117).'</a>';
|
||||
$output .= '</ul>';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
$output .= helpIcon(12);
|
||||
$output .= '<h1>'.WebGUI::International::get(143).'</h1>';
|
||||
$output .= '<ul>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editCompanyInformation').'">'.WebGUI::International::get(124).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editContentSettings').'">'.WebGUI::International::get(525).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editMailSettings').'">'.WebGUI::International::get(133).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editMiscSettings').'">'.WebGUI::International::get(140).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editPrivilegeSettings').'">'.WebGUI::International::get(710).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.WebGUI::International::get(308).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editUserSettings').'">'.WebGUI::International::get(117).'</a>';
|
||||
$output .= '</ul>';
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_saveSettings {
|
||||
WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($key);
|
||||
foreach $key (keys %{$session{form}}) {
|
||||
unless ($key eq "op") {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{$key})." where name='$key'");
|
||||
}
|
||||
}
|
||||
return www_manageSettings();
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use WebGUI::DateTime;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Operation::Shared;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -27,159 +28,175 @@ our @ISA = qw(Exporter);
|
|||
our @EXPORT = qw(&www_viewPageReport &www_viewStatistics &www_viewTrafficReport &www_killSession
|
||||
&www_viewLoginHistory &www_viewActiveSessions);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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 {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::Session::end($session{form}{sid});
|
||||
return www_viewActiveSessions();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
WebGUI::Session::end($session{form}{sid});
|
||||
return www_viewActiveSessions();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewActiveSessions {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $p, @row, $i, $sth, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<h1>'.WebGUI::International::get(425).'</h1>';
|
||||
$sth = WebGUI::SQL->read("select * from users,userSession where users.userId=userSession.userId");
|
||||
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},"%H:%n%p %M/%D/%y").'</td>';
|
||||
$row[$i] .= '<td>'.epochToHuman($data{lastPageView},"%H:%n%p %M/%D/%y").'</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'),\@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});
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
$output = '<h1>'.WebGUI::International::get(425).'</h1>';
|
||||
$sth = WebGUI::SQL->read("select * from users,userSession where users.userId=userSession.userId");
|
||||
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},"%H:%n%p %M/%D/%y").'</td>';
|
||||
$row[$i] .= '<td>'.epochToHuman($data{lastPageView},"%H:%n%p %M/%D/%y").'</td>';
|
||||
$row[$i] .= '<td>'.$data{lastIP}.'</td>';
|
||||
$row[$i] .= '<td align="center">'.deleteIcon("op=killSession&sid=$data{sessionId}").'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
return $output;
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewActiveSessions'),\@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::Privilege::isInGroup(3));
|
||||
my ($output, $p, @row, $i, $sth, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$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} == 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'),\@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});
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
$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} == 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++;
|
||||
}
|
||||
return $output;
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory'),\@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);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewPageReport {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $count, $user, $data, $sth, $page, $pageId);
|
||||
$sth = WebGUI::SQL->read("select pageTitle,pageId,userId,ipAddress,wobjectId from pageStatistics order by pageTitle,userId,ipAddress");
|
||||
while ($data = $sth->hashRef) {
|
||||
if ($data->{userId} == 1) {
|
||||
$user = $data->{ipAddress};
|
||||
} else {
|
||||
$user = $data->{userId};
|
||||
}
|
||||
$page->{$data->{pageId}}{pageTitle} = $data->{pageTitle};
|
||||
$page->{$data->{pageId}}{users}{$user}++;
|
||||
$page->{$data->{pageId}}{views}++;
|
||||
$page->{$data->{pageId}}{interact}++ if ($data->{wobjectId});
|
||||
}
|
||||
$sth->finish;
|
||||
$output = '<h1>Page Statistics</h1>';
|
||||
$output .= '<table><tr><td>Page Title</td><td>Page Views</td><td>Unique Visitors</td><td>Wobject Interactions</td></tr>';
|
||||
foreach $pageId (keys %{$page}) {
|
||||
$output .= '<tr><td>'.$page->{$pageId}{pageTitle}.'</td>';
|
||||
$output .= '<td>'.$page->{$pageId}{views}.'</td>';
|
||||
$count = 0;
|
||||
foreach (keys %{$page->{$pageId}{users}}) {
|
||||
$count++;
|
||||
unless ($session{setting}{trackPageStatistics}) {
|
||||
$output .= WebGUI::International::get(802);
|
||||
} else {
|
||||
$sth = WebGUI::SQL->read("select pageTitle,pageId,userId,ipAddress,wobjectId
|
||||
from pageStatistics order by pageTitle,userId,ipAddress");
|
||||
while ($data = $sth->hashRef) {
|
||||
if ($data->{userId} == 1) {
|
||||
$user = $data->{ipAddress};
|
||||
} else {
|
||||
$user = $data->{userId};
|
||||
}
|
||||
$page->{$data->{pageId}}{pageTitle} = $data->{pageTitle};
|
||||
$page->{$data->{pageId}}{users}{$user}++;
|
||||
$page->{$data->{pageId}}{views}++;
|
||||
$page->{$data->{pageId}}{interact}++ if ($data->{wobjectId});
|
||||
}
|
||||
$output .= '<td>'.$count.'</td>';
|
||||
$output .= '<td>'.$page->{$pageId}{interact}.'</td></tr>';
|
||||
$sth->finish;
|
||||
$output .= '<table width="100%" cellpadding="3" cellspacing="0" border="1">
|
||||
<tr><td class="tableHeader">'.WebGUI::International::get(798).'</td>
|
||||
<td class="tableHeader">'.WebGUI::International::get(799).'</td>
|
||||
<td class="tableHeader">'.WebGUI::International::get(800).'</td>
|
||||
<td class="tableHeader">'.WebGUI::International::get(801).'</td></tr>';
|
||||
foreach $pageId (keys %{$page}) {
|
||||
$output .= '<tr><td class="tableData">'.$page->{$pageId}{pageTitle}.'</td>';
|
||||
$output .= '<td class="tableData">'.$page->{$pageId}{views}.'</td>';
|
||||
$count = 0;
|
||||
foreach (keys %{$page->{$pageId}{users}}) {
|
||||
$count++;
|
||||
}
|
||||
$output .= '<td class="tableData">'.$count.'</td>';
|
||||
$output .= '<td class="tableData">'.$page->{$pageId}{interact}.'</td></tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
return $output;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewStatistics {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $data, $header, $userAgent, $request, $response, $version, $referer);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$userAgent = new LWP::UserAgent;
|
||||
$userAgent->agent("WebGUI-Check/2.0");
|
||||
$userAgent->timeout(10);
|
||||
$header = new HTTP::Headers;
|
||||
$referer = "http://webgui.web.getversion/".$session{env}{SERVER_NAME}.$session{env}{REQUEST_URI};
|
||||
chomp $referer;
|
||||
$header->referer($referer);
|
||||
$request = new HTTP::Request (GET => "http://www.plainblack.com/downloads/latest-version.txt", $header);
|
||||
$response = $userAgent->request($request);
|
||||
$version = $response->content;
|
||||
chomp $version;
|
||||
$output .= helpIcon(12);
|
||||
$output .= '<h1>'.WebGUI::International::get(437).'</h1>';
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(145).'</td><td class="tableData">'.$WebGUI::VERSION.' ('.WebGUI::International::get(349).': '.$version.')</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from userSession");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(146).'</td><td class="tableData">'.$data.' (<a href="'.WebGUI::URL::page("op=viewActiveSessions").'">'.WebGUI::International::get(423).'</a> / <a href="'.WebGUI::URL::page("op=viewLoginHistory").'">'.WebGUI::International::get(424).'</a>)</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId>25");
|
||||
$data++;
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(147).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from wobject");
|
||||
$data--;
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(148).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from style where styleId>25");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(427).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from users where userId>25");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(149).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from groups where groupId>25");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(89).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
$output .= '</table>';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
$userAgent = new LWP::UserAgent;
|
||||
$userAgent->agent("WebGUI-Check/2.0");
|
||||
$userAgent->timeout(10);
|
||||
$header = new HTTP::Headers;
|
||||
$referer = "http://webgui.web.getversion/".$session{env}{SERVER_NAME}.$session{env}{REQUEST_URI};
|
||||
chomp $referer;
|
||||
$header->referer($referer);
|
||||
$request = new HTTP::Request (GET => "http://www.plainblack.com/downloads/latest-version.txt", $header);
|
||||
$response = $userAgent->request($request);
|
||||
$version = $response->content;
|
||||
chomp $version;
|
||||
$output .= helpIcon(12);
|
||||
$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(349).':</td><td class="tableData">'.$version.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId>1000 and parentId<>3");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(147).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId>1000 and parentId=0");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(795).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId=5");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(794).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from wobject where wobjectId > 0 and pageId<>3");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(148).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from style where styleId>1000");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(427).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from template where templateId>1000");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(792).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from collateral where collateralId>1000");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(793).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from userSession");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(146).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from users where userId>25");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(149).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from groups where groupId>25");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(89).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
$output .= '</table>';
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewTrafficReport {
|
||||
return WebGUI::Privilege::adminOnly() unless WebGUI::Privilege::isInGroup(3);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
my ($output, $data);
|
||||
$output = '<h1>Pages</h1>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from pageStatistics where dateStamp>=".(time()-2592000));
|
||||
|
|
@ -198,7 +215,7 @@ sub www_viewTrafficReport {
|
|||
($data) = WebGUI::SQL->quickArray("select count(*) from pageStatistics where dateStamp>=".(time()-86400)
|
||||
." group by ipAddress,userId");
|
||||
$output .= "Last 24 hours: ".$data."<br>";
|
||||
return $output;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue