- 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
to Colin Kuskie for pointing this out and writing some tests)
- 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

View file

@ -17,6 +17,7 @@ package WebGUI::AdminConsole;
use strict;
use WebGUI::International;
use WebGUI::Asset::Template;
use WebGUI::VersionTag;
=head1 NAME
@ -461,12 +462,11 @@ sub render {
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");
while (my ($id, $name, $group) = $rs->array) {
next unless $self->session->user->isInGroup($group);
foreach my $tag (@{WebGUI::VersionTag->getOpenTags($self->session)}) {
next unless $self->session->user->isInGroup($tag->get("groupToUse"));
push(@tags, {
url=>$self->session->url->page("op=setWorkingVersionTag;tagId=".$id),
title=>($id eq $workingId) ? '* '.$name : $name,
url=>$self->session->url->page("op=setWorkingVersionTag;tagId=".$tag->getId),
title=>($tag->getId eq $workingId) ? '* '.$tag->get("name") : $tag->get("name"),
});
}
if (scalar(@tags)) {

View file

@ -490,32 +490,28 @@ sub getAssetAdderLinks {
);
my $newAsset = WebGUI::Asset->newByPropertyHashRef($self->session,\%properties);
next unless $newAsset;
#use Data::Dumper; print Dumper($newAsset);
my $uiLevel = eval{$newAsset->getUiLevel()};
if ($@) {
$self->session->errorHandler->error("Couldn't get UI level of ".$class.". Root cause: ".$@);
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)};
if ($@) {
$self->session->errorHandler->error("Couldn't determine if user can add ".$class." because ".$@);
next;
} else {
next unless ($canAdd);
}
}
next unless ($canAdd);
my $label = eval{$newAsset->getName()};
if ($@) {
$self->session->errorHandler->error("Couldn't get the name of ".$class."because ".$@);
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;
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 {
my $self = shift;
my $definition = $self->get("className")->definition($self->session);
my $uilevel = $self->session->config->get("assetUiLevel");
my $ret;
if ($uilevel && ref $uilevel eq 'HASHREF') {
$ret = $self->session->config->get("assetUiLevel")->{$definition->[0]{className}} || $definition->[0]{uiLevel} || 1 ;
my $uiLevel = $self->session->config->get("assetUiLevel");
if ($uiLevel && ref $uiLevel eq 'HASH') {
return $uiLevel->{$definition->[0]{className}} || $definition->[0]{uiLevel} || 1 ;
} else {
$ret = $definition->[0]{uiLevel} || 1 ;
return $definition->[0]{uiLevel} || 1 ;
}
return $ret;
}
@ -1803,9 +1797,7 @@ Returns "".
sub view {
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 undef;
}
#-------------------------------------------------------------------
@ -2035,6 +2027,10 @@ Returns the view() method of the asset object if the requestor canView.
sub www_view {
my $self = shift;
if ($self->getId eq "PBasset000000000000001") {
$self->session->http->setRedirect($self->getDefault($self->session)->getUrl);
return "1";
}
my $check = $self->checkView;
return $check if (defined $check);
$self->prepareView;

View file

@ -721,6 +721,7 @@ sub www_editListingSave {
moderateGroupId => '4',
postGroupId => '7'
});
WebGUI::VersionTag->getWorking($self->session)->commit;
$data{forumId} = $forum->getId;
$data{status} = "pending";
$isNew = 1;
@ -1105,7 +1106,6 @@ sub www_viewDetail {
$var{screenshot} = $storage->getUrl($listing->{filename});
$var{thumbnail} = $storage->getThumbnailUrl($listing->{filename});
}
$forum->prepareView;
$var{"discussion"} = $forum->view;
$var{'isLoggedIn'} = ($self->session->user->userId ne "1");
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')
});
}
my $rs = $session->db->read("select tagId, name, groupToUse from assetVersionTag where isCommitted=0 and isLocked=0 order by name");
while (my ($id, $name, $group) = $rs->array) {
next unless $session->user->isInGroup($group);
foreach my $tag (@{WebGUI::VersionTag->getOpenTags($session)}) {
next unless $session->user->isInGroup($tag->get("groupToUse"));
push(@tags, {
url=>$session->url->page("op=setWorkingVersionTag;backToSite=1;tagId=".$id),
title=>($id eq $workingId) ? '<span style="color: #000080;">* '.$name.'</span>' : $name,
url=>$session->url->page("op=setWorkingVersionTag;backToSite=1;tagId=".$tag->getId),
title=>($tag->getId eq $workingId) ? '<span style="color: #000080;">* '.$tag->get("name").'</span>' : $tag->get("name"),
icon=>$session->url->extras('spacer.gif')
});
}

View file

@ -360,26 +360,24 @@ sub www_manageVersions {
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">
<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");
while (my ($id,$name,$date,$by,$group) = $sth->array) {
next unless ($session->user->isInGroup($group));
my $u = WebGUI::User->new($session,$by);
foreach my $tag (@{WebGUI::VersionTag->getOpenTags($session)}) {
next unless ($session->user->isInGroup($tag->get("groupToUse")));
my $u = WebGUI::User->new($session,$tag->get("createdBy"));
$output .= '<tr>
<td>'
.$session->icon->delete("op=rollbackVersionTag;tagId=".$id,undef,$rollbackPrompt)
.$session->icon->edit("op=editVersionTag;tagId=".$id)
.$session->icon->delete("op=rollbackVersionTag;tagId=".$tag->getId,undef,$rollbackPrompt)
.$session->icon->edit("op=editVersionTag;tagId=".$tag->getId)
.'</td>
<td><a href="'.$session->url->page("op=manageRevisionsInTag;tagId=".$id).'">'.$name.'</a></td>
<td>'.$session->datetime->epochToHuman($date).'</td>
<td><a href="'.$session->url->page("op=manageRevisionsInTag;tagId=".$tag->getId).'">'.$tag->get("name").'</a></td>
<td>'.$session->datetime->epochToHuman($tag->get("creationDate")).'</td>
<td>'.$u->username.'</td>
<td>';
unless ($workingTagId eq $id) {
$output .= '<a href="'.$session->url->page("op=setWorkingVersionTag;tagId=".$id).'">'.$setTag.'</a> | ';
unless ($workingTagId eq $tag->getId) {
$output .= '<a href="'.$session->url->page("op=setWorkingVersionTag;tagId=".$tag->getId).'">'.$setTag.'</a> | ';
}
$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>';
return $ac->render($output);
}

View file

@ -50,7 +50,7 @@ The path to the filename to index, including the filename.
sub addFile {
my $self = shift;
my $path = shift;
$path =~ m/\.(\w)$/;
$path =~ m/\.(\w+)$/;
my $type = lc($1);
my $filters = $self->session->config->get("searchIndexerPlugins");
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 $output;
if (defined $style) {
$var{'head.tags'} .= $style->get("headBlock");
$output = $style->process(\%var);
} else {
$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 ( )
Returns the number of revisions that are under this tag.