Merge branch 'master' into WebGUI8

This commit is contained in:
Graham Knop 2010-04-13 07:50:02 -05:00
commit 2400f19099
797 changed files with 33894 additions and 27196 deletions

View file

@ -73,35 +73,30 @@ delete (kill) each one via www_killSession
sub www_viewActiveSessions {
my $session = shift;
return $session->privilege->adminOnly unless canView($session);
my ($output, $p, @row, $i, $sth, %data);
tie %data, 'Tie::CPHash';
$sth = $session->db->read("select users.username,users.userId,userSession.sessionId,userSession.expires,
userSession.lastPageView,userSession.lastIP from users,userSession where users.userId=userSession.userId
and users.userId<>1 order by users.username,userSession.lastPageView desc");
while (%data = $sth->hash) {
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
$row[$i] .= '<td>'.$data{sessionId}.'</td>';
$row[$i] .= '<td>'.$session->datetime->epochToHuman($data{expires}).'</td>';
$row[$i] .= '<td>'.$session->datetime->epochToHuman($data{lastPageView}).'</td>';
$row[$i] .= '<td>'.$data{lastIP}.'</td>';
$row[$i] .= '<td align="center">'.$session->icon->delete("op=killSession;sid=$data{sessionId}").'</td></tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new($session,$session->url->page('op=viewActiveSessions'));
$p->setDataByArrayRef(\@row);
my $i18n = WebGUI::International->new($session);
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
$output .= '<tr class="tableHeader"><td>'.$i18n->get(428).'</td>';
$output .= '<td>'.$i18n->get(435).'</td>';
$output .= '<td>'.$i18n->get(432).'</td>';
$output .= '<td>'.$i18n->get(430).'</td>';
$output .= '<td>'.$i18n->get(431).'</td>';
$output .= '<td>'.$i18n->get(436).'</td></tr>';
$output .= $p->getPage($session->form->process("pn"));
$output .= '</table>';
$output .= $p->getBarTraditional($session->form->process("pn"));
return WebGUI::AdminConsole->new($session,"activeSessions")->render($output);
my $i18n = WebGUI::International->new($session);
my $output = '<table border="1" cellpadding="5" cellspacing="0" align="center">';
$output .= '<tr class="tableHeader"><td>'.$i18n->get(428).'</td>';
$output .= '<td>'.$i18n->get(435).'</td>';
$output .= '<td>'.$i18n->get(432).'</td>';
$output .= '<td>'.$i18n->get(430).'</td>';
$output .= '<td>'.$i18n->get(431).'</td>';
$output .= '<td>'.$i18n->get(436).'</td></tr>';
my $p = WebGUI::Paginator->new($session,$session->url->page('op=viewActiveSessions'));
$p->setDataByQuery("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");
my $pn = $p->getPageNumber;
foreach my $data (@{ $p->getPageData() }) {
$output = '<tr class="tableData"><td>'.$data->{username}.' ('.$data->{userId}.')</td>';
$output .= '<td>'.$data->{sessionId}.'</td>';
$output .= '<td>'.$session->datetime->epochToHuman($data->{expires}).'</td>';
$output .= '<td>'.$session->datetime->epochToHuman($data->{lastPageView}).'</td>';
$output .= '<td>'.$data->{lastIP}.'</td>';
$output .= '<td align="center">'.$session->icon->delete("op=killSession;sid=".$data->{sessionId}.";pn=$pn").'</td></tr>';
}
$output .= '</table>';
$output .= $p->getBarTraditional();
return WebGUI::AdminConsole->new($session,"activeSessions")->render($output);
}
1;

View file

@ -294,13 +294,13 @@ sub www_runCronJob {
if ($session->stow->get('singletonWorkflowClash')) {
$session->errorHandler->warn(
"Could not create workflow instance for workflowId '" . $task->get( "workflowId" )
. "': It is a singleton workflow and is still running from the last invocation."
. "' from taskId '".$taskId."': It is a singleton workflow and is still running from the last invocation."
);
return "done";
}
$session->errorHandler->error(
"Could not create workflow instance for workflowId '" . $task->get( "workflowId" )
. "': The result was undefined"
. "' from taskId '".$taskId."': The result was undefined"
);
return "done";
}

View file

@ -195,7 +195,7 @@ sub getGroupSearchForm {
}
my $output = '<div align="center">';
my $i18n = WebGUI::International->new($session);
my $f = WebGUI::HTMLForm->new($session,1);
my $f = WebGUI::HTMLForm->new($session, method => 'GET', );
foreach my $key (keys %{$params}) {
$f->hidden(
-name=>$key,
@ -291,7 +291,7 @@ sub www_addGroupsToGroupSave {
my $session = shift;
return $session->privilege->adminOnly() unless (canEditGroup($session,$session->form->process("gid")) && $session->form->validToken);
my $group = WebGUI::Group->new($session,$session->form->process("gid"));
my @groups = $session->form->group('groups');
my @groups = $session->form->process('groups', 'group', []);
$group->addGroups(\@groups);
return www_manageGroupsInGroup($session);
}
@ -336,7 +336,7 @@ A WebGUI::Session object
sub www_autoAddToGroup {
my $session = shift;
return WebGUI::AdminConsole->new($session,"groups")->render($session->privilege->insufficient()) unless ($session->user->userId ne 1);
return $session->privilege->noAccess() if ($session->user->isVisitor);
my $group = WebGUI::Group->new($session,$session->form->process("groupId"));
if ($group && $group->autoAdd) {
$group->addUsers([$session->user->userId],[$session->form->process("groupId")]);
@ -360,7 +360,7 @@ A WebGUI::Session object
sub www_autoDeleteFromGroup {
my $session = shift;
return WebGUI::AdminConsole->new($session,"groups")->render($session->privilege->insufficient()) unless ($session->user->userId ne 1);
return $session->privilege->noAccess() if ($session->user->isVisitor);
my $group = WebGUI::Group->new($session,$session->form->process("groupId"));
if ($group && $group->autoDelete) {
$group->deleteUsers([$session->user->userId],[$session->form->process("groupId")]);
@ -1011,7 +1011,7 @@ sub www_manageUsersInGroup {
my $session = shift;
return $session->privilege->adminOnly() unless (canEditGroup($session,$session->form->process("gid")));
my $i18n = WebGUI::International->new($session);
my $output = WebGUI::Form::formHeader($session,)
my $output = WebGUI::Form::formHeader($session)
.WebGUI::Form::hidden($session,{
name=>"gid",
value=>$session->form->process("gid")

View file

@ -295,6 +295,13 @@ sub www_editLDAPLink {
-label =>$i18n->get("create account template"),
-hoverHelp =>$i18n->get("create account template description"),
);
$f->template(
-name =>"ldapDeactivateAccountTemplate",
-value =>$form->template("ldapDeactivateAccountTemplate") || $db{ldapDeactivateAccountTemplate},
-namespace =>"Auth/LDAP/Deactivate",
-label =>$i18n->get("deactivate account template"),
-hoverHelp =>$i18n->get("deactivate account template description"),
);
$f->template(
-name =>"ldapLoginTemplate",
-value =>$form->template("ldapLoginTemplate") || $db{ldapLoginTemplate},
@ -340,6 +347,7 @@ sub www_editLDAPLinkSave {
$properties->{ldapWelcomeMessage} = $session->form->textarea("ldapWelcomeMessage");
$properties->{ldapAccountTemplate} = $session->form->template("ldapAccountTemplate");
$properties->{ldapCreateAccountTemplate} = $session->form->template("ldapCreateAccountTemplate");
$properties->{ldapDeactivateAccountTemplate} = $session->form->template("ldapDeactivateAccountTemplate");
$properties->{ldapLoginTemplate} = $session->form->template("ldapLoginTemplate");
$session->db->setRow("ldapLink","ldapLinkId",$properties);
if($session->form->process("returnUrl")) {
@ -361,16 +369,16 @@ links. Each LDAP link is tested and the status of that test is returned.
sub www_listLDAPLinks {
my $session = shift;
return $session->privilege->adminOnly() unless canView($session);
my ($output, $p, $sth, $data, @row, $i);
my $i18n = WebGUI::International->new($session,"AuthLDAP");
my $returnUrl = "";
if ($session->form->process("returnUrl")) {
$returnUrl = ";returnUrl=".$session->url->escape($session->form->process("returnUrl"));
}
$sth = $session->db->read("select * from ldapLink order by ldapLinkName");
$row[$i] = '<tr><td valign="top" class="tableData">&nbsp;</td><td valign="top" class="tableData">'.$i18n->get("LDAPLink_1076").'</td><td>'.$i18n->get("LDAPLink_1077").'</td></tr>';
my $sth = $session->db->read("select * from ldapLink order by ldapLinkName");
my $i = 0;
my @row = ();
$i++;
while ($data = $sth->hashRef) {
while (my $data = $sth->hashRef) {
$row[$i] = '<tr><td valign="top" class="tableData">'
.$session->icon->delete('op=deleteLDAPLink;llid='.$data->{ldapLinkId},$session->url->page(),$i18n->get("LDAPLink_988"))
.$session->icon->edit('op=editLDAPLink;llid='.$data->{ldapLinkId}.$returnUrl)
@ -380,20 +388,27 @@ sub www_listLDAPLinks {
my $ldapLink = WebGUI::LDAPLink->new($session,$data->{ldapLinkId});
my $status = $i18n->get("LDAPLink_1078");
if ($ldapLink->bind) {
$status = $i18n->get("LDAPLink_1079");
} else {
$session->errorHandler->warn($ldapLink->getErrorMessage());
}
$ldapLink->unbind;
if ($ldapLink->bind && $ldapLink->getErrorCode == 0) {
$status = $i18n->get("LDAPLink_1079");
$ldapLink->unbind;
}
else {
$session->errorHandler->warn($ldapLink->getErrorMessage());
$status .= ": ".$ldapLink->getErrorMessage();
}
$row[$i] .= '<td valign="top" class="tableData">'.$status.'</td>';
$row[$i] .= '</tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new($session,$session->url->page('op=listLDAPLinks'));
my $p = WebGUI::Paginator->new($session,$session->url->page('op=listLDAPLinks'));
$p->setDataByArrayRef(\@row);
$output .= '<table border="1" cellpadding="3" cellspacing="0" align="center">';
my $output = qq{<table border="1" cellpadding="3" cellspacing="0" align="center">\n};
$output .= q{<tr><td valign="top" class="tableData">&nbsp;</td><td valign="top" class="tableData">}
. $i18n->get("LDAPLink_1076")
. q{</td><td>}
. $i18n->get("LDAPLink_1077")
. qq{</td></tr>\n};
$output .= $p->getPage;
$output .= '</table>';
$output .= $p->getBarTraditional;

View file

@ -204,6 +204,14 @@ sub definition {
hoverHelp=>$i18n->get("Enable Metadata description"),
defaultValue=>$setting->get("metaDataEnabled")
});
push(@fields, {
tab=>"content",
fieldType=>"interval",
name=>"maxCacheTimeout",
label=>$i18n->get("Maximum cache timeout"),
hoverHelp=>$i18n->get("Maximum cache timeout description"),
defaultValue=>$setting->get("maxCacheTimeout")
});
# user interface settings
push(@fields, {
tab=>"ui",
@ -520,6 +528,7 @@ sub definition {
groupIdAdminActiveSessions
groupIdAdminAdSpace
groupIdAdminCache
groupIdAdminClipboard
groupIdAdminCron
groupIdAdminDatabaseLink
groupIdAdminFilePump
@ -534,6 +543,7 @@ sub definition {
groupIdAdminReplacements
groupIdAdminSpectre
groupIdAdminStatistics
groupIdAdminTrash
groupIdAdminUser
groupIdAdminUserAdd
groupIdAdminVersionTag

View file

@ -93,6 +93,8 @@ sub www_disableSendWebguiStats {
return $session->privilege->adminOnly() unless canView($session);
my $task = WebGUI::Workflow::Cron->new($session, 'send_webgui_statistics');
$task->delete;
my $workflow = WebGUI::Workflow->new($session, 'send_webgui_statistics');
$workflow->set({enabled => 0});
return www_viewStatistics($session);
}
@ -122,6 +124,8 @@ sub www_enableSendWebguiStats {
priority => 3,
title => 'Send WebGUI Statistics',
}, 'send_webgui_statistics');
my $workflow = WebGUI::Workflow->new($session, 'send_webgui_statistics');
$workflow->set({enabled => 1});
return www_viewStatistics($session);
}

View file

@ -276,7 +276,7 @@ sub getUserSearchForm {
$session->scratch->set("userSearchModifier",$session->form->process("modifier")) if defined($session->form->process("modifier"));
my $i18n = WebGUI::International->new($session);
my $output = '<div align="center">'
.WebGUI::Form::formHeader($session,)
.WebGUI::Form::formHeader($session,{ method => 'GET'}, )
.WebGUI::Form::hidden($session,
name => "op",
value => $op
@ -625,27 +625,27 @@ sub www_editUser {
my $i18n = WebGUI::International->new($session, "WebGUI");
my %tabs;
tie %tabs, 'Tie::IxHash';
%tabs = (
"account"=> { label=>$i18n->get("account")},
"profile"=> { label=>$i18n->get("profile")},
"groups"=> { label=>$i18n->get('89')},
);
%tabs = (
"account"=> { label=>$i18n->get("account")},
"profile"=> { label=>$i18n->get("profile")},
"groups"=> { label=>$i18n->get('89')},
);
my $tabform = WebGUI::TabForm->new($session,\%tabs);
$tabform->formHeader({extras=>'autocomplete="off"'});
my $u = WebGUI::User->new($session,($uid eq 'new') ? '' : $uid); #Setting uid to '' when uid is 'new' so visitor defaults prefill field for new user
my $username = ($u->isVisitor && $uid ne "1") ? '' : $u->username;
$tabform->hidden({name=>"op",value=>"editUserSave"});
$tabform->hidden({name=>"uid",value=>$uid});
$tabform->getTab("account")->raw('<tr><td width="170">&nbsp;</td><td>&nbsp;</td></tr>');
$tabform->getTab("account")->readOnly(value=>$uid,label=>$i18n->get(378));
$tabform->getTab("account")->readOnly(value=>$u->karma,label=>$i18n->get(537)) if ($session->setting->get("useKarma"));
$tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->dateCreated,"%z"),label=>$i18n->get(453));
$tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->lastUpdated,"%z"),label=>$i18n->get(454));
$tabform->getTab("account")->text(
-name=>"username",
-label=>$i18n->get(50),
-value=>$username
);
$tabform->hidden({name=>"op",value=>"editUserSave"});
$tabform->hidden({name=>"uid",value=>$uid});
$tabform->getTab("account")->raw('<tr><td width="170">&nbsp;</td><td>&nbsp;</td></tr>');
$tabform->getTab("account")->readOnly(value=>$uid,label=>$i18n->get(378));
$tabform->getTab("account")->readOnly(value=>$u->karma,label=>$i18n->get(537)) if ($session->setting->get("useKarma"));
$tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->dateCreated,"%z"),label=>$i18n->get(453));
$tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->lastUpdated,"%z"),label=>$i18n->get(454));
$tabform->getTab("account")->text(
-name=>"username",
-label=>$i18n->get(50),
-value=>$username
);
my %status;
tie %status, 'Tie::IxHash';
%status = (
@ -658,7 +658,8 @@ sub www_editUser {
-name => "status",
-value => $u->status
);
} else {
}
else {
$tabform->getTab("account")->selectBox(
-name => "status",
-options => \%status,
@ -675,7 +676,7 @@ sub www_editUser {
-options=>$options,
-label=>$i18n->get(164),
-value=>$u->authMethod,
);
);
foreach (@{$session->config->get("authMethods")}) {
my $authInstance = WebGUI::Operation::Auth::getInstance($session,$_,$u->userId);
my $editUserForm = $authInstance->editUserForm;
@ -689,9 +690,10 @@ sub www_editUser {
foreach my $field (@{$category->getFields}) {
next if $field->getId =~ /contentPositions/;
my $label = $field->getLabel . ($field->isRequired ? "*" : '');
if ($field->getId eq "alias" && $u->isVisitor) {
$tabform->getTab("profile")->raw($field->formField({label=>$label},1,undef,1));
} else {
if ($u->isVisitor) {
$tabform->getTab("profile")->raw($field->formField({label=>$label},1,undef,undef,undef,undef,'useFormDefault'));
}
else {
$tabform->getTab("profile")->raw($field->formField({label=>$label},1,$u));
}
}
@ -717,9 +719,9 @@ sub www_editUser {
my @include;
foreach my $group (@exclude) {
unless (
$group eq "1" || $group eq "2" || $group eq "7" # can't remove user from magic groups
|| ($session->user->userId eq $u->userId && $group eq 3) # cannot remove self from admin
|| ($u->isAdmin && $group eq "3") # admin user cannot be remove from admin
$group eq "1" || $group eq "2" || $group eq "7" # can't remove user from magic groups
|| ($session->user->userId eq $uid && $group eq 3) # cannot remove self from admin
|| ($uid eq '3' && $group eq "3") # user Admin cannot be removed from admin group
) {
push(@include,$group);
}
@ -776,7 +778,7 @@ sub www_editUserSave {
#
# Also verify that the posted username is not blank (we need a username)
#
my $postedUsername = $session->form->process("username");
$postedUsername = WebGUI::HTML::filter($postedUsername, "all");
@ -793,16 +795,15 @@ sub www_editUserSave {
$u->authMethod($session->form->process("authMethod"));
$u->status($session->form->process("status"));
# Loop through all of this users authentication methods
foreach (@{$session->config->get("authMethods")}) {
# Instantiate each auth object and call it's save method. These methods are responsible for
# updating authentication information with values supplied by the www_editUser form.
my $authInstance = WebGUI::Operation::Auth::getInstance($session, $_, $actualUserId);
$authInstance->editUserFormSave();
}
# Loop through all of this users authentication methods
foreach (@{$session->config->get("authMethods")}) {
# Instantiate each auth object and call it's save method. These methods are responsible for
# updating authentication information with values supplied by the www_editUser form.
my $authInstance = WebGUI::Operation::Auth::getInstance($session, $_, $actualUserId);
$authInstance->editUserFormSave();
}
# Loop through all profile fields, and update them with new values.
# Loop through all profile fields, and update them with new values.
foreach my $field (@{WebGUI::ProfileField->getFields($session)}) {
next if $field->getId =~ /contentPositions/;
$u->profileField($field->getId,$field->formProcess($u));
@ -839,7 +840,7 @@ sub www_editUserSave {
}
# Display an error telling them the username they are trying to use is not available and suggest alternatives
} else {
$error = '<ul>' . sprintf($i18n->get(77), $postedUsername, $postedUsername, $postedUsername, $session->datetime->epochToHuman($session->datetime->time(),"%y")).'</ul>';
$error = '<ul>' . sprintf($i18n->get(77), $postedUsername, $postedUsername, $postedUsername, $session->datetime->epochToHuman(time(),"%y")).'</ul>';
}
if ($isSecondary) {
return _submenu($session,{workarea => $i18n->get(978)});

View file

@ -374,10 +374,9 @@ sub www_commitVersionTag {
$session->url->page("op=commitVersionTag;tagId=".$tag->getId),
);
$p->setDataByQuery(q{
SELECT assetData.revisionDate, users.username, asset.assetId
SELECT assetData.revisionDate, assetData.revisedBy, asset.assetId
FROM assetData
LEFT JOIN asset ON assetData.assetId = asset.assetId
LEFT JOIN users ON assetData.revisedBy = users.userId
WHERE assetData.tagId=? },
undef,
undef,
@ -385,8 +384,9 @@ sub www_commitVersionTag {
);
foreach my $row ( @{$p->getPageData} ) {
my ( $date, $by, $id, $class) = @{ $row }{ qw( revisionDate username assetId ) };
my ( $date, $byUserId, $id, $class) = @{ $row }{ qw( revisionDate revisedBy assetId ) };
my $asset = WebGUI::Asset->newById($session, $id, $date);
my $byUser = WebGUI::User->new( $session, $byUserId );
$output
.= '<tr><td>'
.$session->icon->view("func=view;revision=".$date, $asset->get("url"))
@ -394,7 +394,7 @@ sub www_commitVersionTag {
<td>'.$asset->getTitle.'</td>
<td><img src="'.$asset->getIcon(1).'" alt="'.$asset->getName.'" />'.$asset->getName.'</td>
<td>'.$session->datetime->epochToHuman($date).'</td>
<td>'.$by.'</td></tr>';
<td>'.$byUser->get('username').'</td></tr>';
}
$output .= '</table>'.$p->getBarSimple;
@ -465,7 +465,7 @@ A reference to the current session.
sub www_leaveVersionTag {
my $session = shift;
WebGUI::VersionTag->getWorking($session)->clearWorking;
WebGUI::VersionTag->getWorking($session)->leaveTag;
return www_manageVersions($session);
}
@ -810,11 +810,12 @@ sub www_manageRevisionsInTag {
. '</tr> '
;
my $p = WebGUI::Paginator->new($session,$session->url->page("op=manageRevisionsInTag;tagId=".$tag->getId));
$p->setDataByQuery("select assetData.revisionDate, users.username, asset.assetId from assetData
left join asset on assetData.assetId=asset.assetId left join users on assetData.revisedBy=users.userId
$p->setDataByQuery("select assetData.revisionDate, assetData.revisedBy, asset.assetId from assetData
left join asset on assetData.assetId=asset.assetId
where assetData.tagId=?",undef, undef, [$tag->getId]);
foreach my $row (@{$p->getPageData}) {
my ($date, $by, $id) = ($row->{revisionDate}, $row->{username}, $row->{assetId});
my ($date,$byUserId,$id) = ($row->{revisionDate}, $row->{revisedBy}, $row->{assetId});
my $byUser = WebGUI::User->new( $session, $byUserId );
my $asset = WebGUI::Asset->newById($session, $id, $date);
# A checkbox for delete and move actions
my $checkbox = WebGUI::Form::checkbox( $session, {
@ -828,7 +829,7 @@ sub www_manageRevisionsInTag {
<td>'.$asset->getTitle.'</td>
<td><img src="'.$asset->getIcon(1).'" alt="'.$asset->getName.'" />'.$asset->getName.'</td>
<td>'.$session->datetime->epochToHuman($date).'</td>
<td>'.$by.'</td></tr>';
<td>'.$byUser->username.'</td></tr>';
}
$output .= '</table>'.$p->getBarSimple.WebGUI::Form::formFooter( $session );
$tag = $session->db->getRow("assetVersionTag","tagId",$tag->getId);