merging 6.5.6 bugfixes
This commit is contained in:
parent
cd83598f7c
commit
a58f2786f7
15 changed files with 207 additions and 88 deletions
|
|
@ -419,6 +419,7 @@ The fieldId to be deleted.
|
|||
=cut
|
||||
|
||||
sub deleteMetaDataField {
|
||||
my $self = shift;
|
||||
my $fieldId = shift;
|
||||
WebGUI::SQL->beginTransaction;
|
||||
WebGUI::SQL->write("delete from metaData_properties where fieldId = ".quote($fieldId));
|
||||
|
|
@ -721,7 +722,7 @@ sub getAssetAdderLinks {
|
|||
} else {
|
||||
$constraint = quoteAndJoin($session{config}{assets});
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("select className,assetId from asset where isPrototype=1 and className in ($constraint)");
|
||||
my $sth = WebGUI::SQL->read("select className,assetId from asset where isPrototype=1 and state='published' and className in ($constraint)");
|
||||
while (my ($class,$id) = $sth->array) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($id,$class);
|
||||
my $url = $self->getUrl("func=add&class=".$class."&prototype=".$id);
|
||||
|
|
@ -1072,6 +1073,33 @@ sub getEditForm {
|
|||
-value=>$self->getValue("isPrototype"),
|
||||
-uiLevel=>9
|
||||
);
|
||||
if ($session{setting}{metaDataEnabled}) {
|
||||
my $meta = $self->getMetaDataFields();
|
||||
foreach my $field (keys %$meta) {
|
||||
my $fieldType = $meta->{$field}{fieldType} || "text";
|
||||
my $options;
|
||||
# Add a "Select..." option on top of a select list to prevent from
|
||||
# saving the value on top of the list when no choice is made.
|
||||
if($fieldType eq "selectList") {
|
||||
$options = {"", WebGUI::International::get("Select...","Asset")};
|
||||
}
|
||||
$tabform->getTab("meta")->dynamicField($fieldType,
|
||||
-name=>"metadata_".$meta->{$field}{fieldId},
|
||||
-label=>$meta->{$field}{fieldName},
|
||||
-uiLevel=>5,
|
||||
-value=>$meta->{$field}{value},
|
||||
-extras=>qq/title="$meta->{$field}{description}"/,
|
||||
-possibleValues=>$meta->{$field}{possibleValues},
|
||||
-options=>$options
|
||||
);
|
||||
}
|
||||
# Add a quick link to add field
|
||||
$tabform->getTab("meta")->readOnly(
|
||||
-value=>'<p><a href="'.WebGUI::URL::page("func=editMetaDataField&fid=new").'">'.
|
||||
WebGUI::International::get('Add new field','Asset').
|
||||
'</a></p>'
|
||||
);
|
||||
}
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
|
|
@ -1287,7 +1315,7 @@ sub getLineage {
|
|||
if (exists $rules->{excludeClasses}) { # deal with exclusions
|
||||
my @set;
|
||||
foreach my $className (@{$rules->{excludeClasses}}) {
|
||||
push(@set,"asset.className <> ".quote($className));
|
||||
push(@set,"asset.className not like ".quote($className.'%'));
|
||||
}
|
||||
$where .= ' and ('.join(" and ",@set).')';
|
||||
}
|
||||
|
|
@ -2352,7 +2380,7 @@ sub www_copy {
|
|||
|
||||
Copies to clipboard assets in a list, then returns self calling method www_manageAssets(), if canEdit. Otherwise returns AdminConsole rendered insufficient privilege.
|
||||
|
||||
cut
|
||||
=cut
|
||||
|
||||
sub www_copyList {
|
||||
my $self = shift;
|
||||
|
|
@ -2478,7 +2506,6 @@ Deletes a MetaDataField and returns www_manageMetaData on self, if user isInGrou
|
|||
|
||||
sub www_deleteMetaDataField {
|
||||
my $self = shift;
|
||||
my $ac = WebGUI::AdminConsole->new("content profiling");
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
|
||||
$self->deleteMetaDataField($session{form}{fid});
|
||||
return $self->www_manageMetaData;
|
||||
|
|
@ -2513,7 +2540,8 @@ sub www_deployPackage {
|
|||
my $packageMasterAssetId = $session{form}{assetId};
|
||||
if (defined $packageMasterAssetId) {
|
||||
my $packageMasterAsset = WebGUI::Asset->newByDynamicClass($packageMasterAssetId);
|
||||
if (defined $packageMasterAsset && $packageMasterAsset->canView) {
|
||||
my $masterLineage = $packageMasterAsset->get("lineage");
|
||||
if (defined $packageMasterAsset && $packageMasterAsset->canView && $self->get("lineage") !~ /^$masterLineage/) {
|
||||
my $deployedTreeMaster = $self->duplicateTree($packageMasterAsset);
|
||||
$deployedTreeMaster->update({isPackage=>0});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,15 +59,16 @@ Returns a boolean indicating whether the user can view the current post.
|
|||
|
||||
sub canView {
|
||||
my $self = shift;
|
||||
if ($self->get("status") eq "approved" || $self->get("status") eq "archived") {
|
||||
return 1;
|
||||
} elsif ($self->get("status") eq "denied" && $self->canEdit) {
|
||||
return 1;
|
||||
} else {
|
||||
return $self->SUPER::canView;
|
||||
}
|
||||
if (($self->get("status") eq "approved" || $self->get("status") eq "archived") && $self->getThread->getParent->canView) {
|
||||
return 1;
|
||||
} elsif ($self->get("status") eq "denied" && $self->canEdit) {
|
||||
return 1;
|
||||
} else {
|
||||
$self->getThread->getParent->canEdit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 chopTitle ( )
|
||||
|
|
@ -429,7 +430,6 @@ sub getTemplateVars {
|
|||
});
|
||||
}
|
||||
}
|
||||
$self->getThread->getParent->appendTemplateLabels(\%var);
|
||||
return \%var;
|
||||
}
|
||||
|
||||
|
|
@ -608,6 +608,7 @@ sub notifySubscribers {
|
|||
my $u = WebGUI::User->new($userId);
|
||||
if ($lang{$u->profileField("language")}{message} eq "") {
|
||||
$lang{$u->profileField("language")}{var} = $self->getTemplateVars($lang{$u->profileField("language")}{var});
|
||||
$self->getThread->getParent->appendTemplateLabels($lang{$u->profileField("language")}{var});
|
||||
$lang{$u->profileField("language")}{var}{url} = WebGUI::URL::getSiteURL().$self->getUrl;
|
||||
$lang{$u->profileField("language")}{var}{'notify.subscription.message'} =
|
||||
WebGUI::International::get(875,"Asset_Post",$u->profileField("language"));
|
||||
|
|
@ -708,6 +709,30 @@ sub rate {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLastPost ( id, date )
|
||||
|
||||
Sets the last reply of this thread.
|
||||
|
||||
=head3 id
|
||||
|
||||
The assetId of the most recent post.
|
||||
|
||||
=head3 date
|
||||
|
||||
The date of the most recent post.
|
||||
|
||||
=cut
|
||||
|
||||
sub setLastPost {
|
||||
my $self = shift;
|
||||
my $id = shift;
|
||||
my $date = shift;
|
||||
$self->update(lastPostId=>$id, lastPostDate=>$date);
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -778,6 +803,25 @@ sub setStatusPending {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trash
|
||||
|
||||
Moves post to the trash and decrements reply counter on thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getThread->decrementReplies if ($self->isReply);
|
||||
if ($self->getThread->get("lastPostId") eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select assetId, dateSubmitted from Post where lineage like ".quote($threadLineage.'%')." and assetId<>".quote($self->getId)." order by dateSubmitted desc");
|
||||
$self->getThread->setLastPost($id,$date);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 unmarkRead ( )
|
||||
|
|
|
|||
|
|
@ -509,6 +509,27 @@ sub subscribe {
|
|||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trash
|
||||
|
||||
Moves thread to the trash and decrements reply counter on thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getParent->decrementThreads;
|
||||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select assetId, dateSubmitted from Post where lineage like ".quote($parentLineage.'%')." and assetId<>".quote($self->getId)." order by dateSubmitted desc");
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 unlock ( )
|
||||
|
|
|
|||
|
|
@ -755,6 +755,29 @@ sub recalculateRating {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLastPost ( id, date )
|
||||
|
||||
Sets the most recent post in this collaboration system.
|
||||
|
||||
=head3 id
|
||||
|
||||
The assetId of the most recent post.
|
||||
|
||||
=head3 date
|
||||
|
||||
The date of the most recent post.
|
||||
|
||||
=cut
|
||||
|
||||
sub setLastPost {
|
||||
my $self = shift;
|
||||
my $id = shift;
|
||||
my $date = shift;
|
||||
$self->update(lastPostId=>$id, lastPostDate=>$date);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 subscribe ( )
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ sub view {
|
|||
WebGUI::Style::setLink($session{config}{extrasURL}."/draggable.css",{ type=>"text/css", rel=>"stylesheet", media=>"all" });
|
||||
$vars{"dragger.icon"} = WebGUI::Icon::dragIcon();
|
||||
$vars{"dragger.init"} = '
|
||||
<iframe id="dragSubmitter" style="display: none;"></iframe>
|
||||
<iframe id="dragSubmitter" style="display: none;" src="'.$session{config}{extrasURL}.'/spacer.gif"></iframe>
|
||||
<script>
|
||||
dragable_init("'.$self->getUrl("func=setContentPositions&map=").'");
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ sub getEditForm {
|
|||
name=>"returnUrl",
|
||||
value=>$session{form}{returnUrl}
|
||||
});
|
||||
my ($descendantsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
|
||||
my ($descendantsChecked, $ancestorsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
|
||||
my @assetsToInclude = split("\n",$self->getValue("assetsToInclude"));
|
||||
my $afterScript;
|
||||
foreach my $item (@assetsToInclude) {
|
||||
|
|
@ -94,6 +94,8 @@ sub getEditForm {
|
|||
} elsif ($item eq "descendants") {
|
||||
$descendantsChecked = 1;
|
||||
$afterScript = "displayNavEndPoint = false;";
|
||||
} elsif ($item eq "ancestors") {
|
||||
$ancestorsChecked = 1;
|
||||
} elsif ($item eq "siblings") {
|
||||
$siblingsChecked = 1;
|
||||
} elsif ($item eq "pedigree") {
|
||||
|
|
@ -118,7 +120,7 @@ sub getEditForm {
|
|||
$tabform->getTab("properties")->readOnly(
|
||||
-label=>"Relatives to Include",
|
||||
-value=>WebGUI::Form::checkbox({
|
||||
checked=>$selfChecked,
|
||||
checked=>$ancestorsChecked,
|
||||
name=>"assetsToInclude",
|
||||
value=>"ancestors"
|
||||
}).'Ancestors<br />'
|
||||
|
|
@ -265,16 +267,16 @@ sub view {
|
|||
if ($self->get("startType") eq "specificUrl") {
|
||||
$start = WebGUI::Asset->newByUrl($self->get("startPoint"));
|
||||
} elsif ($self->get("startType") eq "relativeToRoot") {
|
||||
unless (($self->get("startPoint")+1) >= $self->getLineageLength) {
|
||||
$start = WebGUI::Asset->newByLineage(substr($session{asset}->get("lineage"),0, ($self->get("startPoint") + 1) * 6));
|
||||
unless (($self->get("startPoint")+1) >= $current->getLineageLength) {
|
||||
$start = WebGUI::Asset->newByLineage(substr($current->get("lineage"),0, ($self->get("startPoint") + 1) * 6));
|
||||
}
|
||||
} elsif ($self->get("startType") eq "relativeToCurrentUrl") {
|
||||
if ($self->get("startPoint") < 0) {
|
||||
$start = WebGUI::Asset->newByLineage(substr($session{asset}->get("lineage"),0,
|
||||
($session{asset}->getLineageLength - $self->get("startPoint") + 1) * 6
|
||||
$start = WebGUI::Asset->newByLineage(substr($current->get("lineage"),0,
|
||||
($current->getLineageLength - $self->get("startPoint") + 1) * 6
|
||||
));
|
||||
} elsif ($self->get("startPoint") > 0) {
|
||||
my $lineage = $session{asset}->getLineage;
|
||||
my $lineage = $current->getLineage;
|
||||
for (1..$self->get("startPoint")) {
|
||||
$lineage .= $self->formatRank(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ This package contains utility methods for WebGUI's database link system.
|
|||
use WebGUI::DatabaseLink;
|
||||
$hashRef = WebGUI::DatabaseLink::getList();
|
||||
%databaseLink = WebGUI::DatabaseLink::get($databaseLinkId);
|
||||
%using = WebGUI::Databaselink::whatIsUsing($databaseLinkId);
|
||||
|
||||
$dbLink = WebGUI::DatabaseLink->new($databaseLinkId);
|
||||
$dbh = $dbLink->dbh;
|
||||
|
|
@ -75,41 +74,6 @@ sub get {
|
|||
return WebGUI::SQL->quickHash("select * from databaseLink where databaseLinkId=".quote($_[0]));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
=head2 whatIsUsing ( databaseLinkId )
|
||||
|
||||
Returns an array of hashrefs containing items which use a database link. This method will
|
||||
need to be updated any time a new item starts using Database Links.
|
||||
|
||||
=head3 databaseLinkId
|
||||
|
||||
A valid databaseLinkId
|
||||
|
||||
=cut
|
||||
|
||||
sub whatIsUsing {
|
||||
# get list of SQLReports
|
||||
my $sql = 'select wobject.wobjectId, wobject.title, page.menuTitle, page.urlizedTitle from wobject, SQLReport, page '.
|
||||
'where SQLReport.databaseLinkId = '.quote($_[0]).' and SQLReport.wobjectId = wobject.wobjectId '.
|
||||
'and wobject.pageId = page.pageId';
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
my @using;
|
||||
while (my $data = $sth->hashRef()) {
|
||||
push @using, $data;
|
||||
}
|
||||
$sth->finish;
|
||||
|
||||
# get list of groups
|
||||
$sql = 'select groupId, groupName from groups where databaseLinkId = '.quote($_[0]);
|
||||
$sth = WebGUI::SQL->read($sql);
|
||||
while (my $data = $sth->hashRef()) {
|
||||
push @using, $data;
|
||||
}
|
||||
$sth->finish;
|
||||
|
||||
return @using;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
=head2 disconnect ( )
|
||||
|
||||
|
|
|
|||
|
|
@ -60,14 +60,6 @@ sub www_deleteDatabaseLink {
|
|||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output);
|
||||
$output .= WebGUI::International::get(988).'<p>';
|
||||
foreach my $using (WebGUI::DatabaseLink::whatIsUsing($session{form}{dlid})) {
|
||||
if ($using->{title}) {
|
||||
$output .= '<li>'.WebGUI::International::get(1,'SQLReport').' <a href="'.WebGUI::URL::page('func=edit&wid='.$using->{wobjectId},$using->{urlizedTitle}).'">'
|
||||
.$using->{title}.'</a> '.WebGUI::International::get(989).' <a href="'.WebGUI::URL::gateway($using->{urlizedTitle}).'">'.$using->{menuTitle}.'</a>.</li>';
|
||||
} else {
|
||||
$output .= '<li>'.'Group'.' <a href="'.WebGUI::URL::page('op=editGroup&gid='.$using->{groupId}).'">'.$using->{groupName}.'</a>.</li>';
|
||||
}
|
||||
}
|
||||
$output .= '<p><div align="center"><a href="'.
|
||||
WebGUI::URL::page('op=deleteDatabaseLinkConfirm&dlid='.$session{form}{dlid})
|
||||
.'">'.WebGUI::International::get(44).'</a>';
|
||||
|
|
@ -93,7 +85,9 @@ sub www_editDatabaseLink {
|
|||
} else {
|
||||
%db = WebGUI::SQL->quickHash("select * from databaseLink where databaseLinkId=".quote($session{form}{dlid}));
|
||||
}
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f = WebGUI::HTMLForm->new(
|
||||
-extras=>'autocomplete="off"'
|
||||
);
|
||||
$f->hidden("op","editDatabaseLinkSave");
|
||||
$f->hidden("dlid",$session{form}{dlid});
|
||||
$f->readOnly($session{form}{dlid},WebGUI::International::get(991));
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ sub makeUrlCompliant {
|
|||
my $value = shift;
|
||||
$value =~ s/\s+$//; #removes trailing whitespace
|
||||
$value =~ s/^\s+//; #removes leading whitespace
|
||||
$value =~ s/^\\//; #removes leading slash
|
||||
$value =~ s/ /-/g; #replaces whitespace with hyphens
|
||||
$value =~ s/\.$//; #removes trailing period
|
||||
$value =~ s/[^A-Za-z0-9\-\.\_\/]//g; #removes all funky characters
|
||||
$value =~ s/^\///; #removes a preceeding /
|
||||
$value =~ s/^\///; #removes a leading /
|
||||
$value =~ s/\/$//; #removes a trailing /
|
||||
$value =~ s/\/\//\//g; #removes double /
|
||||
return $value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1945,8 +1945,8 @@ You also cannot import a theme from a version of WebGUI that is newer than the o
|
|||
},
|
||||
|
||||
'988' => {
|
||||
message => q|Are you certain you wish to delete this database link? The following items are using this link and will no longer work if you delete it:|,
|
||||
lastUpdated => 1056151382
|
||||
message => q|Are you certain you wish to delete this database link?|,
|
||||
lastUpdated => 1116151382
|
||||
},
|
||||
|
||||
'35' => {
|
||||
|
|
@ -3289,11 +3289,6 @@ You can search users based on username and email address. You can do partial sea
|
|||
lastUpdated => 1052850265
|
||||
},
|
||||
|
||||
'989' => {
|
||||
message => q|on page|,
|
||||
lastUpdated => 1056151382
|
||||
},
|
||||
|
||||
'1071' => {
|
||||
message => q|Env HTTP Host|,
|
||||
lastUpdated => 1066641511
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue