can use the edit branch feature to set metadata properties
other bug fixes
This commit is contained in:
parent
debd4e8c82
commit
c287ab8a3e
6 changed files with 92 additions and 5 deletions
|
|
@ -1,6 +1,9 @@
|
|||
6.7.0
|
||||
- Being in the admins group automatically results in a UI level capable of
|
||||
seeing everything.
|
||||
- fix [ 1251390 ] Security tab doesn't appear for member of Admins
|
||||
- HTTP Proxy URLs can now be up to 2048 characters long.
|
||||
- The Edit Branch function now allows you to recursively set meta data.
|
||||
- Fixed a potential problem where editing a page under rare very rare
|
||||
conditions could destroy the not found page.
|
||||
- Added the ability to override the UI Level of any field in the edit form of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/perl
|
||||
my $toVersion = "6.7.0";
|
||||
|
||||
use lib "../../lib";
|
||||
use File::Path;
|
||||
|
|
@ -21,7 +21,7 @@ GetOptions(
|
|||
|
||||
WebGUI::Session::open("../..",$configFile);
|
||||
|
||||
WebGUI::SQL->write("insert into webguiVersion values ('6.7.0','upgrade',unix_timestamp())");
|
||||
WebGUI::SQL->write("insert into webguiVersion value (".quote($toVersion).",'upgrade',".time().")");
|
||||
|
||||
giveSnippetsMimeTypes();
|
||||
addAssetVersioning();
|
||||
|
|
@ -30,9 +30,16 @@ insertHelpTemplate();
|
|||
makeSyndicatedContentChanges();
|
||||
removeOldThemeSystem();
|
||||
addSectionsToSurveys();
|
||||
increaseProxyUrlLength();
|
||||
|
||||
WebGUI::Session::close();
|
||||
|
||||
#-------------------------------------------------
|
||||
sub increaseProxyUrlLength {
|
||||
print "\tMaking HTTP Proxy URLs accept lengths of up to 2048 characters.\n" unless ($quiet);
|
||||
WebGUI::SQL->write("alter table HttpProxy change proxiedUrl proxiedUrl text");
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub giveSnippetsMimeTypes {
|
||||
print "\tAllowing snippets to handle mime types.\n" unless ($quiet);
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ sub getAssetAdderLinks {
|
|||
if ($@) {
|
||||
WebGUI::ErrorHandler::error("Couldn't get UI level of ".$class." because ".$@);
|
||||
} else {
|
||||
next if ($uiLevel > $session{user}{uiLevel} || WebGUI::Grouping::isInGroup(3));
|
||||
next if ($uiLevel > $session{user}{uiLevel} && !WebGUI::Grouping::isInGroup(3));
|
||||
}
|
||||
my $canAdd = eval{$class->canAdd()};
|
||||
if ($@) {
|
||||
|
|
@ -1087,6 +1087,11 @@ sub processPropertiesFromFormPost {
|
|||
);
|
||||
}
|
||||
}
|
||||
foreach my $form (keys %{$session{form}}) {
|
||||
if ($form =~ /^metadata_(.*)$/) {
|
||||
$self->updateMetaData($1,$session{form}{$form});
|
||||
}
|
||||
}
|
||||
$data{title} = "Untitled" unless ($data{title});
|
||||
$data{menuTitle} = $data{title} unless ($data{menuTitle});
|
||||
unless ($data{url}) {
|
||||
|
|
|
|||
|
|
@ -237,6 +237,37 @@ sub www_editBranch {
|
|||
-uiLevel=>6,
|
||||
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo({name=>"change_groupIdEdit"})
|
||||
);
|
||||
$tabform->addTab("meta",WebGUI::International::get("Metadata","Asset"),3);
|
||||
$tabform->getTab("meta")->textarea(
|
||||
-name=>"extraHeadTags",
|
||||
-label=>WebGUI::International::get("extra head tags","Asset"),
|
||||
-hoverHelp=>WebGUI::International::get('extra head tags description',"Asset"),
|
||||
-value=>$self->get("extraHeadTags"),
|
||||
-uiLevel=>5,
|
||||
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo({name=>"change_extraHeadTags"})
|
||||
);
|
||||
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,
|
||||
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo({name=>"change_metadata_".$meta->{$field}{fieldId}})
|
||||
);
|
||||
}
|
||||
}
|
||||
return $ac->render($tabform->print, "Edit Branch");
|
||||
}
|
||||
|
||||
|
|
@ -265,6 +296,7 @@ sub www_editBranchSave {
|
|||
$data{ownerUserId} = WebGUI::FormProcessor::selectList("ownerUserId") if (WebGUI::FormProcessor::yesNo("change_ownerUserId"));
|
||||
$data{groupIdView} = WebGUI::FormProcessor::group("groupIdView") if (WebGUI::FormProcessor::yesNo("change_groupIdView"));
|
||||
$data{groupIdEdit} = WebGUI::FormProcessor::group("groupIdEdit") if (WebGUI::FormProcessor::yesNo("change_groupIdEdit"));
|
||||
$data{extraHeadTags} = WebGUI::FormProcessor::group("extraHeadTags") if (WebGUI::FormProcessor::yesNo("change_extraHeadTags"));
|
||||
my ($urlBaseBy, $urlBase, $endOfUrl);
|
||||
my $changeUrl = WebGUI::FormProcessor::yesNo("change_url");
|
||||
if ($changeUrl) {
|
||||
|
|
@ -292,7 +324,15 @@ sub www_editBranchSave {
|
|||
$data{url} .= $descendant->get("url");
|
||||
}
|
||||
}
|
||||
$descendant->update(\%data);
|
||||
my $newRevision = $descendant->addRevision(\%data);
|
||||
foreach my $form (keys %{$session{form}}) {
|
||||
if ($form =~ /^metadata_(.*)$/) {
|
||||
my $fieldName = $1;
|
||||
if (WebGUI::FormProcessor::yesNo("change_metadata_".$fieldName)) {
|
||||
$newRevision->updateMetaData($fieldName,$session{form}{$form});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $self->{_parent};
|
||||
$session{asset} = $self->getParent;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,38 @@ sub getMetaDataFields {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 updateMetaData ( fieldName, value )
|
||||
|
||||
Updates the value of a metadata field for this asset.
|
||||
|
||||
=head3 fieldName
|
||||
|
||||
The name of the field to update.
|
||||
|
||||
=head3 value
|
||||
|
||||
The value to set this field to. Leave blank to unset it.
|
||||
|
||||
=cut
|
||||
|
||||
sub updateMetaData {
|
||||
my $self = shift;
|
||||
my $fieldName = shift;
|
||||
my $value = shift;
|
||||
my ($exists) = WebGUI::SQL->quickArray("select count(*) from metaData_values where assetId = ".quote($self->getId)." and fieldId = ".quote($fieldName));
|
||||
if (!$exists && $value ne "") {
|
||||
WebGUI::SQL->write("insert into metaData_values (fieldId, assetId) values (".quote($fieldName).",".quote($self->getId).")");
|
||||
}
|
||||
if ($value eq "") { # Keep it clean
|
||||
WebGUI::SQL->write("delete from metaData_values where assetId = ".quote($self->getId)." and fieldId = ".quote($fieldName));
|
||||
} else {
|
||||
WebGUI::SQL->write("update metaData_values set value = ".quote($value)." where assetId = ".quote($self->getId)." and fieldId=".quote($fieldName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteMetaDataField ( )
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ sub displayLogin {
|
|||
my $method = $_[0] || "login";
|
||||
my $vars = $_[1];
|
||||
unless ($session{form}{op} eq "auth") {
|
||||
WebGUI::Session::setScratch("redirectAfterLogin",WebGUI::URL::getSiteURL().WebGUI::URL::getScriptURL().$session{env}{PATH_INFO}."?".$session{env}{QUERY_STRING});
|
||||
WebGUI::Session::setScratch("redirectAfterLogin",WebGUI::URL::gateway($session{env}{PATH_INFO},$session{env}{QUERY_STRING}));
|
||||
}
|
||||
$vars->{title} = WebGUI::International::get(66);
|
||||
my $action;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue