- fix: Head Block in styles

- fix: select assetVersionTag
 - fix: Infinite recursion
 - fix: assetUiLevel override broken
 - fix: Indexing files failes (derck)
 - fix: Unable to approve New listings on Matrix
This commit is contained in:
JT Smith 2006-07-25 17:15:57 +00:00
parent de35e950bf
commit 03b4b0ed33
9 changed files with 63 additions and 44 deletions

View file

@ -43,6 +43,12 @@
- fix: Splat_random Macro not so random (Wouter van Oijen / ProcoliX) (Thanks - fix: Splat_random Macro not so random (Wouter van Oijen / ProcoliX) (Thanks
to Colin Kuskie for pointing this out and writing some tests) to Colin Kuskie for pointing this out and writing some tests)
- rfe: phone validation javascript - rfe: phone validation javascript
- fix: Head Block in styles
- fix: select assetVersionTag
- fix: Infinite recursion
- fix: assetUiLevel override broken
- fix: Indexing files failes (derck)
- fix: Unable to approve New listings on Matrix
7.0.2 7.0.2

View file

@ -17,6 +17,7 @@ package WebGUI::AdminConsole;
use strict; use strict;
use WebGUI::International; use WebGUI::International;
use WebGUI::Asset::Template; use WebGUI::Asset::Template;
use WebGUI::VersionTag;
=head1 NAME =head1 NAME
@ -461,12 +462,11 @@ sub render {
icon=>$self->session->url->extras('adminConsole/small/versionTags.gif') icon=>$self->session->url->extras('adminConsole/small/versionTags.gif')
}); });
} }
my $rs = $self->session->db->read("select tagId, name, groupToUse from assetVersionTag where isCommitted=0 and isLocked=0 order by name"); foreach my $tag (@{WebGUI::VersionTag->getOpenTags($self->session)}) {
while (my ($id, $name, $group) = $rs->array) { next unless $self->session->user->isInGroup($tag->get("groupToUse"));
next unless $self->session->user->isInGroup($group);
push(@tags, { push(@tags, {
url=>$self->session->url->page("op=setWorkingVersionTag;tagId=".$id), url=>$self->session->url->page("op=setWorkingVersionTag;tagId=".$tag->getId),
title=>($id eq $workingId) ? '* '.$name : $name, title=>($tag->getId eq $workingId) ? '* '.$tag->get("name") : $tag->get("name"),
}); });
} }
if (scalar(@tags)) { if (scalar(@tags)) {

View file

@ -490,32 +490,28 @@ sub getAssetAdderLinks {
); );
my $newAsset = WebGUI::Asset->newByPropertyHashRef($self->session,\%properties); my $newAsset = WebGUI::Asset->newByPropertyHashRef($self->session,\%properties);
next unless $newAsset; next unless $newAsset;
#use Data::Dumper; print Dumper($newAsset);
my $uiLevel = eval{$newAsset->getUiLevel()}; my $uiLevel = eval{$newAsset->getUiLevel()};
if ($@) { if ($@) {
$self->session->errorHandler->error("Couldn't get UI level of ".$class.". Root cause: ".$@); $self->session->errorHandler->error("Couldn't get UI level of ".$class.". Root cause: ".$@);
next; next;
} else {
next if ($uiLevel > $self->session->user->profileField("uiLevel") && !$self->session->user->isInGroup(3));
} }
next if ($uiLevel > $self->session->user->profileField("uiLevel"));# && !$self->session->user->isInGroup(3));
my $canAdd = eval{$class->canAdd($self->session)}; my $canAdd = eval{$class->canAdd($self->session)};
if ($@) { if ($@) {
$self->session->errorHandler->error("Couldn't determine if user can add ".$class." because ".$@); $self->session->errorHandler->error("Couldn't determine if user can add ".$class." because ".$@);
next; next;
} else {
next unless ($canAdd);
} }
next unless ($canAdd);
my $label = eval{$newAsset->getName()}; my $label = eval{$newAsset->getName()};
if ($@) { if ($@) {
$self->session->errorHandler->error("Couldn't get the name of ".$class."because ".$@); $self->session->errorHandler->error("Couldn't get the name of ".$class."because ".$@);
next; next;
} else {
my $url = $self->getUrl("func=add;class=".$class);
$url = $self->session->url->append($url,$addToUrl) if ($addToUrl);
$links{$label}{url} = $url;
$links{$label}{icon} = $newAsset->getIcon;
$links{$label}{'icon.small'} = $newAsset->getIcon(1);
} }
my $url = $self->getUrl("func=add;class=".$class);
$url = $self->session->url->append($url,$addToUrl) if ($addToUrl);
$links{$label}{url} = $url;
$links{$label}{icon} = $newAsset->getIcon;
$links{$label}{'icon.small'} = $newAsset->getIcon(1);
} }
my $constraint; my $constraint;
if ($type eq "assetContainers") { if ($type eq "assetContainers") {
@ -984,14 +980,12 @@ Returns the UI Level specified in the asset definition or from the config file i
sub getUiLevel { sub getUiLevel {
my $self = shift; my $self = shift;
my $definition = $self->get("className")->definition($self->session); my $definition = $self->get("className")->definition($self->session);
my $uilevel = $self->session->config->get("assetUiLevel"); my $uiLevel = $self->session->config->get("assetUiLevel");
my $ret; if ($uiLevel && ref $uiLevel eq 'HASH') {
if ($uilevel && ref $uilevel eq 'HASHREF') { return $uiLevel->{$definition->[0]{className}} || $definition->[0]{uiLevel} || 1 ;
$ret = $self->session->config->get("assetUiLevel")->{$definition->[0]{className}} || $definition->[0]{uiLevel} || 1 ;
} else { } else {
$ret = $definition->[0]{uiLevel} || 1 ; return $definition->[0]{uiLevel} || 1 ;
} }
return $ret;
} }
@ -1803,9 +1797,7 @@ Returns "".
sub view { sub view {
my $self = shift; my $self = shift;
$self->session->http->setRedirect($self->getDefault($self->session)->getUrl) if ($self->getId eq "PBasset000000000000001");
return $self->getToolbar if ($self->session->var->get("adminOn")); return $self->getToolbar if ($self->session->var->get("adminOn"));
return undef;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -2035,6 +2027,10 @@ Returns the view() method of the asset object if the requestor canView.
sub www_view { sub www_view {
my $self = shift; my $self = shift;
if ($self->getId eq "PBasset000000000000001") {
$self->session->http->setRedirect($self->getDefault($self->session)->getUrl);
return "1";
}
my $check = $self->checkView; my $check = $self->checkView;
return $check if (defined $check); return $check if (defined $check);
$self->prepareView; $self->prepareView;

View file

@ -721,6 +721,7 @@ sub www_editListingSave {
moderateGroupId => '4', moderateGroupId => '4',
postGroupId => '7' postGroupId => '7'
}); });
WebGUI::VersionTag->getWorking($self->session)->commit;
$data{forumId} = $forum->getId; $data{forumId} = $forum->getId;
$data{status} = "pending"; $data{status} = "pending";
$isNew = 1; $isNew = 1;
@ -1105,7 +1106,6 @@ sub www_viewDetail {
$var{screenshot} = $storage->getUrl($listing->{filename}); $var{screenshot} = $storage->getUrl($listing->{filename});
$var{thumbnail} = $storage->getThumbnailUrl($listing->{filename}); $var{thumbnail} = $storage->getThumbnailUrl($listing->{filename});
} }
$forum->prepareView;
$var{"discussion"} = $forum->view; $var{"discussion"} = $forum->view;
$var{'isLoggedIn'} = ($self->session->user->userId ne "1"); $var{'isLoggedIn'} = ($self->session->user->userId ne "1");
if ($self->session->form->process("do") eq "sendEmail" && $self->session->form->process("verify","captcha")) { if ($self->session->form->process("do") eq "sendEmail" && $self->session->form->process("verify","captcha")) {

View file

@ -105,12 +105,11 @@ sub process {
icon=>$session->url->extras('adminConsole/small/versionTags.gif') icon=>$session->url->extras('adminConsole/small/versionTags.gif')
}); });
} }
my $rs = $session->db->read("select tagId, name, groupToUse from assetVersionTag where isCommitted=0 and isLocked=0 order by name"); foreach my $tag (@{WebGUI::VersionTag->getOpenTags($session)}) {
while (my ($id, $name, $group) = $rs->array) { next unless $session->user->isInGroup($tag->get("groupToUse"));
next unless $session->user->isInGroup($group);
push(@tags, { push(@tags, {
url=>$session->url->page("op=setWorkingVersionTag;backToSite=1;tagId=".$id), url=>$session->url->page("op=setWorkingVersionTag;backToSite=1;tagId=".$tag->getId),
title=>($id eq $workingId) ? '<span style="color: #000080;">* '.$name.'</span>' : $name, title=>($tag->getId eq $workingId) ? '<span style="color: #000080;">* '.$tag->get("name").'</span>' : $tag->get("name"),
icon=>$session->url->extras('spacer.gif') icon=>$session->url->extras('spacer.gif')
}); });
} }

View file

@ -360,26 +360,24 @@ sub www_manageVersions {
my $commitPrompt = $i18n->get("commit version tag confirm"); my $commitPrompt = $i18n->get("commit version tag confirm");
my $output = '<p>'.$i18n->get("current tag is called").': <b>'.$tag.'</b>.</p><table width="100%" class="content"> my $output = '<p>'.$i18n->get("current tag is called").': <b>'.$tag.'</b>.</p><table width="100%" class="content">
<tr><th></th><th>'.$i18n->get("version tag name").'</th><th>'.$i18n->get("created on").'</th><th>'.$i18n->get("created by").'</th><th></th></tr> '; <tr><th></th><th>'.$i18n->get("version tag name").'</th><th>'.$i18n->get("created on").'</th><th>'.$i18n->get("created by").'</th><th></th></tr> ';
my $sth = $session->db->read("select tagId,name,creationDate,createdBy,groupToUse from assetVersionTag where isCommitted=0 and isLocked=0"); foreach my $tag (@{WebGUI::VersionTag->getOpenTags($session)}) {
while (my ($id,$name,$date,$by,$group) = $sth->array) { next unless ($session->user->isInGroup($tag->get("groupToUse")));
next unless ($session->user->isInGroup($group)); my $u = WebGUI::User->new($session,$tag->get("createdBy"));
my $u = WebGUI::User->new($session,$by);
$output .= '<tr> $output .= '<tr>
<td>' <td>'
.$session->icon->delete("op=rollbackVersionTag;tagId=".$id,undef,$rollbackPrompt) .$session->icon->delete("op=rollbackVersionTag;tagId=".$tag->getId,undef,$rollbackPrompt)
.$session->icon->edit("op=editVersionTag;tagId=".$id) .$session->icon->edit("op=editVersionTag;tagId=".$tag->getId)
.'</td> .'</td>
<td><a href="'.$session->url->page("op=manageRevisionsInTag;tagId=".$id).'">'.$name.'</a></td> <td><a href="'.$session->url->page("op=manageRevisionsInTag;tagId=".$tag->getId).'">'.$tag->get("name").'</a></td>
<td>'.$session->datetime->epochToHuman($date).'</td> <td>'.$session->datetime->epochToHuman($tag->get("creationDate")).'</td>
<td>'.$u->username.'</td> <td>'.$u->username.'</td>
<td>'; <td>';
unless ($workingTagId eq $id) { unless ($workingTagId eq $tag->getId) {
$output .= '<a href="'.$session->url->page("op=setWorkingVersionTag;tagId=".$id).'">'.$setTag.'</a> | '; $output .= '<a href="'.$session->url->page("op=setWorkingVersionTag;tagId=".$tag->getId).'">'.$setTag.'</a> | ';
} }
$output .=' $output .='
<a href="'.$session->url->page("op=commitVersionTag;tagId=".$id).'" onclick="return confirm(\''.$commitPrompt.'\');">'.$commit.'</a></td></tr>'; <a href="'.$session->url->page("op=commitVersionTag;tagId=".$tag->getId).'" onclick="return confirm(\''.$commitPrompt.'\');">'.$commit.'</a></td></tr>';
} }
$sth->finish;
$output .= '</table>'; $output .= '</table>';
return $ac->render($output); return $ac->render($output);
} }

View file

@ -50,7 +50,7 @@ The path to the filename to index, including the filename.
sub addFile { sub addFile {
my $self = shift; my $self = shift;
my $path = shift; my $path = shift;
$path =~ m/\.(\w)$/; $path =~ m/\.(\w+)$/;
my $type = lc($1); my $type = lc($1);
my $filters = $self->session->config->get("searchIndexerPlugins"); my $filters = $self->session->config->get("searchIndexerPlugins");
my $filter = $filters->{$type}; my $filter = $filters->{$type};

View file

@ -192,6 +192,7 @@ if ($self->session->user->isInGroup(2)) {
my $style = WebGUI::Asset::Template->new($self->session,$templateId); my $style = WebGUI::Asset::Template->new($self->session,$templateId);
my $output; my $output;
if (defined $style) { if (defined $style) {
$var{'head.tags'} .= $style->get("headBlock");
$output = $style->process(\%var); $output = $style->process(\%var);
} else { } else {
$output = "WebGUI was unable to instantiate your style template.".$var{'body.content'}; $output = "WebGUI was unable to instantiate your style template.".$var{'body.content'};

View file

@ -164,6 +164,25 @@ sub getId {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getOpenTags ( session )
Returns an array reference containing all the open version tag objects. This is a class method.
=cut
sub getOpenTags {
my $class = shift;
my $session = shift;
my @tags = ();
my $sth = $session->db->read("select * from assetVersionTag where isCommitted=0 and isLocked=0 order by name");
while (my $data = $sth->hashRef) {
push(@tags, bless {_session=>$session, _id=>$data->{tagId}, _data=>$data}, $class);
}
return \@tags;
}
#-------------------------------------------------------------------
=head2 getRevisionCount ( ) =head2 getRevisionCount ( )
Returns the number of revisions that are under this tag. Returns the number of revisions that are under this tag.