- fix: Uncommitted, new Assets BREAK Navigations

- fix: I get on the chewed page
 - fix: Bug in updateMetaData function in AssetMetaData.pm
 - fix: Problems with In/Out Board
 - fix: Alternate Apache Port breaks "Commit with Approval"
 - Rearranged the "Getting Started" page in the default content to make it
   easier to follow for noobs.
This commit is contained in:
JT Smith 2006-06-12 19:41:09 +00:00
parent fcc81333d7
commit ce50d2808b
8 changed files with 49 additions and 39 deletions

View file

@ -205,7 +205,7 @@ sub canModerate {
#-------------------------------------------------------------------
sub canPost {
my $self = shift;
return $self->session->user->isInGroup($self->get("postGroupId")) || $self->canEdit;
return ($self->get("status") eq "approved" && ($self->session->user->isInGroup($self->get("postGroupId")) || $self->canEdit));
}

View file

@ -304,37 +304,32 @@ sub www_edit {
#-------------------------------------------------------------------
sub www_selectDelegates {
my $self = shift;
#Uncomment the sql query below (lines 286 - 294) to show all users of the system in the delegate select list
#my $sql = sprintf "select users.username,
#users.userId,
#a.fieldData as firstName,
#b.fieldData as lastName
#from users
#left join userProfileData a on users.userId=a.userId and a.fieldName='firstName'
#left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
#where users.userId<>'1' and users.status='Active' and users.userId<>%s
#group by userId", $self->session->db->quote($self->session->user->userId);
#Comment the sql query below (lines 297 - 307) to show all users of the system in the delegate select list
my $sql = sprintf "select users.username,
users.userId,
a.fieldData as firstName,
b.fieldData as lastName
from users, InOutBoard, groupings
left join userProfileData a on users.userId=a.userId and a.fieldName='firstName'
left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
left join userProfileData c on users.userId=c.userId and c.fieldName='department'
left join InOutBoard_status on users.userId=InOutBoard_status.userId and InOutBoard_status.assetId=%s
where users.userId<>'1' and groupings.groupId=InOutBoard.inOutGroup and users.status='Active' and users.userId <> %s and groupings.userId=users.userId and InOutBoard.inOutGroup=%s
group by userId", $self->session->db->quote($self->getId), $self->session->db->quote($self->session->user->userId), $self->session->db->quote($self->getValue("inOutGroup")) ;
my %userNames = ();
my $sth = $self->session->db->read($sql);
my $sth = $self->session->db->read(
"select
users.username,
users.userId,
a.fieldData as firstName,
b.fieldData as lastName
from users
left join groupings on users.userId=groupings.userId
left join InOutBoard on groupings.groupId=InOutBoard.inOutGroup
left join userProfileData a on users.userId=a.userId and a.fieldName='firstName'
left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
left join userProfileData c on users.userId=c.userId and c.fieldName='department'
left join InOutBoard_status on users.userId=InOutBoard_status.userId and InOutBoard_status.assetId=?
where
users.userId<>'1'
and users.status='Active'
and users.userId <> ?
and InOutBoard.inOutGroup=?
group by userId
",[$self->getId, $self->session->user->userId, $self->getValue("inOutGroup")]);
while (my $data = $sth->hashRef) {
$userNames{ $data->{userId} } = _defineUsername($data);
}
$sth->finish;
$sql = sprintf "select delegateUserId from InOutBoard_delegates where userId=%s and assetId=%s",
my $sql = sprintf "select delegateUserId from InOutBoard_delegates where userId=%s and assetId=%s",
$self->session->db->quote($self->session->user->userId), $self->session->db->quote($self->getId);
my $delegates = $self->session->db->buildArrayRef($sql);
my $i18n = WebGUI::International->new($self->session,"Asset_InOutBoard");

View file

@ -102,13 +102,13 @@ sub getMetaDataFields {
#-------------------------------------------------------------------
=head2 updateMetaData ( fieldName, value )
=head2 updateMetaData ( fieldId, value )
Updates the value of a metadata field for this asset.
=head3 fieldName
=head3 fieldId
The name of the field to update.
The unique Id of the field to update.
=head3 value
@ -118,16 +118,17 @@ The value to set this field to. Leave blank to unset it.
sub updateMetaData {
my $self = shift;
my $fieldName = shift;
my $fieldId = shift;
my $value = shift;
my ($exists) = $self->session->db->quickArray("select count(*) from metaData_values where assetId = ".$self->session->db->quote($self->getId)." and fieldId = ".$self->session->db->quote($fieldName));
my $db = $self->session->db;
my ($exists) = $db->quickArray("select count(*) from metaData_values where assetId = ? and fieldId = ?",[$self->getId, $fieldId]);
if (!$exists && $value ne "") {
$self->session->db->write("insert into metaData_values (fieldId, assetId) values (".$self->session->db->quote($fieldName).",".$self->session->db->quote($self->getId).")");
$db->write("insert into metaData_values (fieldId, assetId) values (?,?)",[$fieldId, $self->getId]);
}
if ($value eq "") { # Keep it clean
$self->session->db->write("delete from metaData_values where assetId = ".$self->session->db->quote($self->getId)." and fieldId = ".$self->session->db->quote($fieldName));
$db->write("delete from metaData_values where assetId = ? and fieldId = ?",[$self->getId, $fieldId]);
} else {
$self->session->db->write("update metaData_values set value = ".$self->session->db->quote($value)." where assetId = ".$self->session->db->quote($self->getId)." and fieldId=".$self->session->db->quote($fieldName));
$db->write("update metaData_values set value = ? where assetId = ? and fieldId=?", [$value, $self->getId, $fieldId]);
}
}

View file

@ -118,7 +118,7 @@ sub toHtmlWithWrapper {
my $template = WebGUI::Asset::Template->new($self->session,$self->get('value'));
if (defined $template && $template->canEdit) {
my $returnUrl;
if (defined $self->session->asset && ref $self->session->asset eq "WebGUI::Asset::Template") {
if (defined $self->session->asset && ref $self->session->asset ne "WebGUI::Asset::Template") {
$returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl);
}
my $buttons = $self->session->icon->edit("func=edit".$returnUrl,$template->get("url"));

View file

@ -240,7 +240,9 @@ sub getSiteURL {
if ($self->session->env->get("HTTPS") eq "on") {
$proto = "https://";
}
$self->{_siteUrl} = $proto.$site;
my $port = "";
$port = ":".$self->session->config->get("webServerPort") if ($self->session->config->get("webServerPort"));
$self->{_siteUrl} = $proto.$site.$port;
}
return $self->{_siteUrl};
}