- fix: Help is missing style

- fix: Setting expire password on user creation does nothing
 - fix: Collaboration settings in help
 - Lots of template fixes.
This commit is contained in:
JT Smith 2006-06-02 16:22:55 +00:00
parent 8d93d6bf2b
commit 771d11f833
12 changed files with 181 additions and 208 deletions

View file

@ -152,9 +152,9 @@ Unique hash identifier for a user. If not specified, uses current userId.
sub canView {
my $self = shift;
my $userId = shift || $self->session->user->userId;
my $user = WebGUI::User->new($self->session, $userId);
return 0 unless ($self->get("state") eq "published");
my $userId = shift;
my $user = $self->session->user;
$user = WebGUI::User->new($self->session, $userId) if (defined $userId);
if ($userId eq $self->get("ownerUserId")) {
return 1;
} elsif ($user->isInGroup($self->get("groupIdView"))) {
@ -174,19 +174,18 @@ Returns error messages if a user can't view due to publishing problems, otherwis
sub checkView {
my $self = shift;
unless ($self->canView) {
if ($self->get("state") eq "published") { # no privileges, make em log in
return $self->session->privilege->noAccess();
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^trash/) { # show em trash
$self->session->http->setRedirect($self->getUrl("func=manageTrash"));
return undef;
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^clipboard/) { # show em clipboard
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
return undef;
} else { # tell em it doesn't exist anymore
$self->session->http->setStatus("410");
return WebGUI::Asset->getNotFound($self->session)->www_view;
}
return $self->session->privilege->noAccess() unless $self->canView;
if ($self->session->var->isAdminOn && $self->get("state") =~ /^trash/) { # show em trash
$self->session->http->setRedirect($self->getUrl("func=manageTrash"));
return "redirect";
} elsif ($self->session->var->isAdminOn && $self->get("state") =~ /^clipboard/) { # show em clipboard
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
return "redirect";
} elsif ($self->get("state") ne "published" && $self->get("state") ne "archived") { # tell em it doesn't exist anymore
$self->session->http->setStatus("410");
my $notFound = WebGUI::Asset->getNotFound($self->session);
$self->session->asset($notFound);
return $notFound->www_view;
}
$self->logView();
# must find a way to do this next line better
@ -2012,7 +2011,8 @@ Returns the view() method of the asset object if the requestor canView.
sub www_view {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->canView;
my $check = $self->checkView;
return $check if (defined $check);
$self->prepareView;
$self->session->output->print($self->view);
return undef;

View file

@ -294,7 +294,7 @@ sub view {
}
}
$var{description} = $self->get("description");
$var{"new.template"} = $self->getUrl.";overrideTemplateId=";
$var{"new.template"} = $self->getUrl("func=view").";overrideTemplateId=";
$var{"description.full"} = $var{description};
$var{"description.full"} =~ s/\^\-\;//g;
$var{"description.first.100words"} = $var{"description.full"};

View file

@ -562,7 +562,11 @@ sub view {
}
my $maxHeadlines = $self->get('maxHeadlines') || 1000000;
my @urls = split(/\s+/,$self->get('rssUrl'));
return $self->processTemplate({},$self->get('templateId')) unless (scalar(@urls));
my @validatedUrls = ();
foreach my $url (@urls) {
push(@validatedUrls, $url) if ($url =~ m/^http/);
}
return $self->processTemplate({},$self->get('templateId')) unless (scalar(@validatedUrls));
my $title=$self->get('title');
#We came into this subroutine as
@ -570,7 +574,7 @@ sub view {
my %var;
my($item_loop,$rss_feeds)=$self->_get_items(\@urls, $maxHeadlines);
my($item_loop,$rss_feeds)=$self->_get_items(\@validatedUrls, $maxHeadlines);
if(@$rss_feeds > 1){
#If there is more than one (valid) feed in this wobject, put in the wobject description info.
$var{'channel.title'} = $title;

View file

@ -97,30 +97,6 @@ sub _logLogin {
.$self->session->db->quote($self->session->env->get("REMOTE_ADDR")).",".$self->session->db->quote($self->session->env->get("HTTP_USER_AGENT")).")");
}
#-------------------------------------------------------------------
=head2 addUserForm ( userId )
Creates elements for the add user form specific to this Authentication Method.
=cut
sub addUserForm {
#Added for interface purposes only. Needs to be implemented in the subclass.
}
#-------------------------------------------------------------------
=head2 addUserFormSave ( properties [,userId] )
Saves user elements unique to this authentication method
=cut
sub addUserFormSave {
my $self = shift;
$self->saveParams(($_[1] || $self->userId),$self->authMethod,$_[0]);
}
#-------------------------------------------------------------------

View file

@ -76,78 +76,6 @@ sub _isValidLDAPUser {
$self->error($error);
return $error eq "";
}
#-------------------------------------------------------------------
=head2 addUserForm ( )
Creates user form elements specific to this Auth Method.
=cut
sub addUserForm {
my $self = shift;
my $userData = $self->getParams;
my $connection = $self->{_connection};
my $ldapUrl = $self->session->form->process('authLDAP_ldapUrl') || $userData->{ldapUrl} || $connection->{ldapURL};
my $connectDN = $self->session->form->process('authLDAP_connectDN') || $userData->{connectDN};
my $ldapConnection = $self->session->form->process('authLDAP_ldapConnection') || $userData->{ldapConnection};
my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink");
my $f = WebGUI::HTMLForm->new($self->session);
my $jscript = "";
my $i18n = WebGUI::International->new($self->session,'AuthLDAP');
if(scalar(keys %{$ldapLinks}) > 0) {
my $jsArray = "";
foreach my $key (keys %{$ldapLinks}) {
next unless ($key);
$jsArray .= 'ldapValue["'.$key.'"]="'.$ldapLinks->{$key}.'";'."\n";
}
$jsArray .= 'ldapValue["0"]="'.$ldapUrl.'";'."\n";
$jscript = qq|
<script type="text/javascript">
<!--
var ldapValue = new Array();
$jsArray
//-->
</script>|;
$f->selectBox(
-name=>"authLDAP_ldapConnection",
-label=>$i18n->get("ldapConnection"),
-hoverHelp=>$i18n->get("ldapConnection description"),
-options=>WebGUI::LDAPLink->getList($self->session,),
-value=>[$ldapConnection],
-extras=>q|onchange="this.form.authLDAP_ldapUrl.value=ldapValue[this.options[this.selectedIndex].value];"|
);
}
$f->url(
-name => "authLDAP_ldapUrl",
-label => $i18n->get(3),
-value => $ldapUrl,
);
$f->text(
-name => "authLDAP_connectDN",
-label => $i18n->get(4),
-value => $connectDN,
);
$self->session->style->setRawHeadTags($jscript);
return $f->printRowsOnly;
}
#-------------------------------------------------------------------
=head2 addUserFormSave ( )
Saves user elements unique to this authentication method
=cut
sub addUserFormSave {
my $self = shift;
my $properties;
$properties->{connectDN} = $self->session->form->process('authLDAP_connectDN');
$properties->{ldapUrl} = $self->session->form->process('authLDAP_ldapUrl');
$properties->{ldapConnection} = $self->session->form->process('authLDAP_ldapConnection');
$self->SUPER::addUserFormSave($properties);
}
#-------------------------------------------------------------------
sub authenticate {
@ -335,7 +263,50 @@ sub displayLogin {
sub editUserForm {
my $self = shift;
return $self->addUserForm;
my $userData = $self->getParams;
my $connection = $self->{_connection};
my $ldapUrl = $self->session->form->process('authLDAP_ldapUrl') || $userData->{ldapUrl} || $connection->{ldapURL};
my $connectDN = $self->session->form->process('authLDAP_connectDN') || $userData->{connectDN};
my $ldapConnection = $self->session->form->process('authLDAP_ldapConnection') || $userData->{ldapConnection};
my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink");
my $f = WebGUI::HTMLForm->new($self->session);
my $jscript = "";
my $i18n = WebGUI::International->new($self->session,'AuthLDAP');
if(scalar(keys %{$ldapLinks}) > 0) {
my $jsArray = "";
foreach my $key (keys %{$ldapLinks}) {
next unless ($key);
$jsArray .= 'ldapValue["'.$key.'"]="'.$ldapLinks->{$key}.'";'."\n";
}
$jsArray .= 'ldapValue["0"]="'.$ldapUrl.'";'."\n";
$jscript = qq|
<script type="text/javascript">
<!--
var ldapValue = new Array();
$jsArray
//-->
</script>|;
$f->selectBox(
-name=>"authLDAP_ldapConnection",
-label=>$i18n->get("ldapConnection"),
-hoverHelp=>$i18n->get("ldapConnection description"),
-options=>WebGUI::LDAPLink->getList($self->session,),
-value=>[$ldapConnection],
-extras=>q|onchange="this.form.authLDAP_ldapUrl.value=ldapValue[this.options[this.selectedIndex].value];"|
);
}
$f->url(
-name => "authLDAP_ldapUrl",
-label => $i18n->get(3),
-value => $ldapUrl,
);
$f->text(
-name => "authLDAP_connectDN",
-label => $i18n->get(4),
-value => $connectDN,
);
$self->session->style->setRawHeadTags($jscript);
return $f->printRowsOnly;
}
#-------------------------------------------------------------------
@ -348,7 +319,11 @@ sub editUserForm {
sub editUserFormSave {
my $self = shift;
return $self->addUserFormSave;
my $properties;
$properties->{connectDN} = $self->session->form->process('authLDAP_connectDN');
$properties->{ldapUrl} = $self->session->form->process('authLDAP_ldapUrl');
$properties->{ldapConnection} = $self->session->form->process('authLDAP_ldapConnection');
$self->SUPER::editUserFormSave($properties);
}
#-------------------------------------------------------------------

View file

@ -70,75 +70,6 @@ sub _logSecurityMessage {
$self->session->errorHandler->security("change password. Password changed successfully");
}
#-------------------------------------------------------------------
=head2 addUserForm ( )
Creates user form elements specific to this Auth Method.
=cut
sub addUserForm {
my $self = shift;
my $userData = $self->getParams;
my $f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session);
$f->password(
name=>"authWebGUI.identifier",
label=>$i18n->get(51),
value=>"password"
);
$f->interval(
-name=>"authWebGUI.passwordTimeout",
-label=>$i18n->get(16,'AuthWebGUI'),
-value=>$userData->{passwordTimeout},
-defaultValue=>$self->session->setting->get("webguiPasswordTimeout")
);
my $userChange = $self->session->setting->get("webguiChangeUsername");
if($userChange || $userChange eq "0"){
$userChange = $userData->{changeUsername};
}
$f->yesNo(
-name=>"authWebGUI.changeUsername",
-value=>$userChange,
-label=>$i18n->get(21,'AuthWebGUI')
);
my $passwordChange = $self->session->setting->get("webguiChangePassword");
if($passwordChange || $passwordChange eq "0"){
$passwordChange = $userData->{changePassword};
}
$f->yesNo(
-name=>"authWebGUI.changePassword",
-value=>$passwordChange,
-label=>$i18n->get(20,'AuthWebGUI')
);
return $f->printRowsOnly;
}
#-------------------------------------------------------------------
=head2 addUserFormSave ( )
Saves user elements unique to this authentication method
=cut
sub addUserFormSave {
my $self = shift;
my $properties;
unless ($self->session->form->process('authWebGUI.identifier') eq "password") {
$properties->{identifier} = Digest::MD5::md5_base64($self->session->form->process('authWebGUI.identifier'));
}
$properties->{changeUsername} = $self->session->form->process('authWebGUI.changeUsername');
$properties->{changePassword} = $self->session->form->process('authWebGUI.changePassword');
$properties->{passwordTimeout} = $self->session->form->interval('authWebGUI.passwordTimeout');
$properties->{passwordLastUpdated} =$self->session->datetime->time();
if($self->session->setting->get("webguiExpirePasswordOnCreation")){
$properties->{passwordLastUpdated} =$self->session->datetime->time() - $properties->{passwordTimeout};
}
$self->SUPER::addUserFormSave($properties);
}
#-------------------------------------------------------------------
sub authenticate {
my $self = shift;
@ -322,7 +253,39 @@ sub displayLogin {
sub editUserForm {
my $self = shift;
return $self->addUserForm;
my $userData = $self->getParams;
my $f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session);
$f->password(
name=>"authWebGUI.identifier",
label=>$i18n->get(51),
value=>"password"
);
$f->interval(
-name=>"authWebGUI.passwordTimeout",
-label=>$i18n->get(16,'AuthWebGUI'),
-value=>$userData->{passwordTimeout},
-defaultValue=>$self->session->setting->get("webguiPasswordTimeout")
);
my $userChange = $self->session->setting->get("webguiChangeUsername");
if($userChange || $userChange eq "0"){
$userChange = $userData->{changeUsername};
}
$f->yesNo(
-name=>"authWebGUI.changeUsername",
-value=>$userChange,
-label=>$i18n->get(21,'AuthWebGUI')
);
my $passwordChange = $self->session->setting->get("webguiChangePassword");
if($passwordChange || $passwordChange eq "0"){
$passwordChange = $userData->{changePassword};
}
$f->yesNo(
-name=>"authWebGUI.changePassword",
-value=>$passwordChange,
-label=>$i18n->get(20,'AuthWebGUI')
);
return $f->printRowsOnly;
}
#-------------------------------------------------------------------
@ -347,6 +310,12 @@ sub editUserFormSave {
$properties->{passwordTimeout} = $self->session->form->interval('authWebGUI.passwordTimeout');
$properties->{changeUsername} = $self->session->form->process('authWebGUI.changeUsername');
$properties->{changePassword} = $self->session->form->process('authWebGUI.changePassword');
if($userId eq "new") {
$properties->{passwordLastUpdated} =$self->session->datetime->time();
if ($self->session->setting->get("webguiExpirePasswordOnCreation")){
$properties->{passwordLastUpdated} =$self->session->datetime->time() - $properties->{passwordTimeout};
}
}
$self->SUPER::editUserFormSave($properties);
}
@ -498,8 +467,9 @@ sub login {
if($self->getSetting("passwordTimeout") && $userData->{passwordTimeout}){
my $expireTime = $userData->{passwordLastUpdated} + $userData->{passwordTimeout};
if ($self->session->datetime->time() >= $expireTime){
my $userId = $self->userId;
$self->logout;
return $self->resetExpiredPassword($self->userId);
return $self->resetExpiredPassword($userId);
}
}
@ -619,19 +589,14 @@ sub resetExpiredPasswordSave {
$error .= '<li>'.$i18n->get(12,'AuthWebGUI').'</li>' if ($self->session->form->process("oldPassword") eq $self->session->form->process("identifier"));
$error .= $self->error if(!$self->_isValidPassword($self->session->form->process("identifier"),$self->session->form->process("identifierConfirm")));
return $self->resetExpiredPassword("<h1>".$i18n->get(70)."</h1>".$error) if($error ne "");
return $self->resetExpiredPassword($u->userId, "<h1>".$i18n->get(70)."</h1>".$error) if($error ne "");
$properties->{identifier} = Digest::MD5::md5_base64($self->session->form->process("identifier"));
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$self->saveParams($u->userId,$self->authMethod,$properties);
$self->_logSecurityMessage();
$msg = $self->login;
if($msg eq ""){
$msg = "<li>".$i18n->get(17,'AuthWebGUI').'</li>';
}
return $self->displayLogin($msg);
return $self->SUPER::login();
}
#-------------------------------------------------------------------

View file

@ -146,6 +146,51 @@ our $HELP = {
description => 'enable avatars description',
namespace => 'Asset_Collaboration',
},
{
title => 'get mail',
description => 'get mail help',
namespace => 'Asset_Collaboration',
},
{
title => 'mail server',
description => 'mail server help',
namespace => 'Asset_Collaboration',
},
{
title => 'mail account',
description => 'mail account help',
namespace => 'Asset_Collaboration',
},
{
title => 'mail password',
description => 'mail password help',
namespace => 'Asset_Collaboration',
},
{
title => 'mail address',
description => 'mail address help',
namespace => 'Asset_Collaboration',
},
{
title => 'get mail interval',
description => 'get mail interval help',
namespace => 'Asset_Collaboration',
},
{
title => 'mail prefix',
description => 'mail prefix help',
namespace => 'Asset_Collaboration',
},
{
title => 'auto subscribe to thread',
description => 'auto subscribe to thread help',
namespace => 'Asset_Collaboration',
},
{
title => 'require subscription for email posting',
description => 'require subscription for email posting help',
namespace => 'Asset_Collaboration',
},
],
related => [
{

View file

@ -531,18 +531,10 @@ sub www_emailGroup {
sub www_emailGroupSend {
my $session = shift;
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3) || _hasSecondaryPrivilege($session,$session->form->process("gid")));
my ($sth, $email);
$sth = $session->db->read("select b.fieldData from groupings a left join userProfileData b
on a.userId=b.userId and b.fieldName='email' where a.groupId=".$session->db->quote($session->form->process("gid")));
while (($email) = $sth->array) {
if ($email ne "") {
my $mail = WebGUI::Mail::Send->create($session, {to=>$email,subject=>$session->form->process("subject"),from=>$session->form->process("from")});
$mail->addHtml($session->form->process("message","HTMLArea"));
$mail->addFooter;
$mail->queue;
}
}
$sth->finish;
my $mail = WebGUI::Mail::Send->create($session, {toGroup=>$session->form->process("gid"),subject=>$session->form->process("subject"),from=>$session->form->process("from")});
$mail->addHtml($session->form->process("message","HTMLArea"));
$mail->addFooter;
$mail->queue;
my $i18n = WebGUI::International->new($session);
return _submenu($session,$i18n->get(812));
}

View file

@ -256,6 +256,7 @@ sub www_viewHelp {
my $session = shift;
return $session->privilege->insufficient() unless ($session->user->isInGroup(7));
my $ac = WebGUI::AdminConsole->new($session,"help");
$session->style->setLink($session->url->extras("/help.css"), {rel=>"stylesheet", type=>"text/css"});
my $namespace = $session->form->process("namespace","className") || "WebGUI";
my $i18n = WebGUI::International->new($session, $namespace);
my $help = _get($session,$session->form->process("hid"),$namespace);