Remove getValue from Assets, except for those in getEditForm which will go away later.
This commit is contained in:
parent
1b647c70f2
commit
ec5208839e
9 changed files with 45 additions and 45 deletions
|
|
@ -278,7 +278,7 @@ sub getTemplateVarsEditForm {
|
|||
for my $key ( keys %{$definition} ) {
|
||||
next if $definition->{$key}->{noFormPost};
|
||||
$definition->{$key}->{name} = $key;
|
||||
$definition->{$key}->{value} = $self->getValue($key);
|
||||
$definition->{$key}->{value} = $self->$key;
|
||||
$var->{ "form_$key" }
|
||||
= WebGUI::Form::dynamicField( $session, %{$definition->{$key}} );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ sub getEditForm {
|
|||
-defaultValue =>'Untitled',
|
||||
-label =>$i18n->get("product name label"),
|
||||
-hoverHelp =>$i18n->get('product name description'),
|
||||
-value =>$self->getValue('title'),
|
||||
-value =>$self->title,
|
||||
);
|
||||
$form->image(
|
||||
-name =>'screenshots',
|
||||
|
|
@ -302,19 +302,19 @@ sub getEditForm {
|
|||
-maxAttachments =>20,
|
||||
-label =>$i18n->get("screenshots label"),
|
||||
-hoverHelp =>$i18n->get("screenshots description"),,
|
||||
-value =>$self->getValue('screenshots'),
|
||||
-value =>$self->screenshots,
|
||||
);
|
||||
$form->HTMLArea(
|
||||
-name =>'description',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("description label"),
|
||||
-hoverHelp =>$i18n->get("description description"),
|
||||
-value =>$self->getValue('description'),
|
||||
-value =>$self->description,
|
||||
);
|
||||
if ($self->getParent->canEdit) {
|
||||
$form->user(
|
||||
name =>"ownerUserId",
|
||||
value =>$self->getValue('ownerUserId'),
|
||||
value =>$self->ownerUserId,
|
||||
label =>$i18n->get('maintainer label'),
|
||||
hoverHelp =>$i18n->get('maintainer description'),
|
||||
);
|
||||
|
|
@ -337,28 +337,28 @@ sub getEditForm {
|
|||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("version label"),
|
||||
-hoverHelp =>$i18n->get("version description"),
|
||||
-value =>$self->getValue('version'),
|
||||
-value =>$self->version,
|
||||
);
|
||||
$form->text(
|
||||
-name =>'manufacturerName',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("manufacturerName label"),
|
||||
-hoverHelp =>$i18n->get("manufacturerName description"),
|
||||
-value =>$self->getValue('manufacturerName'),
|
||||
-value =>$self->manufacturerName,
|
||||
);
|
||||
$form->url(
|
||||
-name =>'manufacturerURL',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("manufacturerURL label"),
|
||||
-hoverHelp =>$i18n->get("manufacturerURL description"),
|
||||
-value =>$self->getValue('manufacturerURL'),
|
||||
-value =>$self->manufacturerURL,
|
||||
);
|
||||
$form->url(
|
||||
-name =>'productURL',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("productURL label"),
|
||||
-hoverHelp =>$i18n->get("productURL description"),
|
||||
-value =>$self->getValue('productURL'),
|
||||
-value =>$self->productURL,
|
||||
);
|
||||
|
||||
foreach my $category (keys %{$self->getParent->getCategories}) {
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ Returns a URL to the owner's avatar.
|
|||
sub getAvatarUrl {
|
||||
my $self = shift;
|
||||
my $parent = $self->getThread->getParent;
|
||||
return '' unless $parent and $parent->getValue("avatarsEnabled");
|
||||
return '' unless $parent and $parent->avatarsEnabled;
|
||||
my $user = WebGUI::User->new($self->session, $self->ownerUserId);
|
||||
#Get avatar field, storage Id.
|
||||
my $storageId = $user->profileField("avatar");
|
||||
|
|
@ -1459,7 +1459,7 @@ sub www_edit {
|
|||
value=>$form->process("class","className")
|
||||
});
|
||||
|
||||
if($self->getThread->getParent->getValue("useCaptcha")) {
|
||||
if($self->getThread->getParent->useCaptcha) {
|
||||
$var{'useCaptcha' } = "true";
|
||||
|
||||
use WebGUI::Form::Captcha;
|
||||
|
|
@ -1534,16 +1534,16 @@ sub www_edit {
|
|||
});
|
||||
$var{'form.header'} .= WebGUI::Form::hidden($session, {
|
||||
name=>"ownerUserId",
|
||||
value=>$self->getValue("ownerUserId")
|
||||
value=>$self->ownerUserId
|
||||
});
|
||||
$var{'form.header'} .= WebGUI::Form::hidden($session, {
|
||||
name=>"username",
|
||||
value=>$self->getValue("username")
|
||||
value=>$self->username
|
||||
});
|
||||
$var{isEdit} = 1;
|
||||
$content = $form->process('content') || $self->getValue("content");
|
||||
$title = $form->process('title') || $self->getValue("title");
|
||||
$synopsis = $form->process('synopsis') || $self->getValue("synopsis");
|
||||
$content = $form->process('content') || $self->content;
|
||||
$title = $form->process('title') || $self->title;
|
||||
$synopsis = $form->process('synopsis') || $self->synopsis;
|
||||
}
|
||||
|
||||
$var{'archive.form'} = WebGUI::Form::yesNo($session, {
|
||||
|
|
@ -1568,13 +1568,13 @@ sub www_edit {
|
|||
$var{'user.isVisitor' } = ($user->isVisitor);
|
||||
$var{'visitorName.form'} = WebGUI::Form::text($session, {
|
||||
name => "visitorName",
|
||||
value => $form->process('visitorName') || $self->getValue("visitorName")
|
||||
value => $form->process('visitorName') || $self->visitorName
|
||||
});
|
||||
|
||||
for my $x (1..5) {
|
||||
my $userDefinedValue
|
||||
= $form->process("userDefined".$x)
|
||||
|| $self->getValue("userDefined".$x)
|
||||
|| $self->get("userDefined".$x)
|
||||
;
|
||||
$var{'userDefined'.$x} = $userDefinedValue;
|
||||
$var{'userDefined'.$x.'.form'}
|
||||
|
|
@ -1644,13 +1644,13 @@ sub www_edit {
|
|||
$var{'karmaScale.form'} = WebGUI::Form::integer($session, {
|
||||
name=>"karmaScale",
|
||||
defaultValue=>$self->getThread->getParent->defaultKarmaScale,
|
||||
value=>$self->getValue("karmaScale"),
|
||||
value=>$self->karmaScale,
|
||||
});
|
||||
$var{karmaIsEnabled} = $session->setting->useKarma;
|
||||
$var{'form.preview'} = WebGUI::Form::submit($session, {
|
||||
value=>$i18n->get("preview","Asset_Collaboration")
|
||||
});
|
||||
my $numberOfAttachments = $self->getThread->getParent->getValue("attachmentsPerPost");
|
||||
my $numberOfAttachments = $self->getThread->getParent->attachmentsPerPost;
|
||||
$var{'attachment.form'} = WebGUI::Form::image($session, {
|
||||
name=>"storageId",
|
||||
value=>$self->storageId,
|
||||
|
|
@ -1660,7 +1660,7 @@ sub www_edit {
|
|||
|
||||
$var{'contentType.form'} = WebGUI::Form::contentType($session, {
|
||||
name=>'contentType',
|
||||
value=>$self->getValue("contentType") || "mixed",
|
||||
value=>$self->contentType || "mixed",
|
||||
});
|
||||
if ($session->setting->get("metaDataEnabled")
|
||||
&& $self->getThread->getParent->enablePostMetaData) {
|
||||
|
|
@ -1716,7 +1716,7 @@ We're extending www_editSave() here to deal with editing a post that has been de
|
|||
sub www_editSave {
|
||||
my $self = shift;
|
||||
my $assetId = $self->session->form->param("assetId");
|
||||
if($assetId eq "new" && $self->getThread->getParent->getValue("useCaptcha")) {
|
||||
if($assetId eq "new" && $self->getThread->getParent->useCaptcha) {
|
||||
my $captcha = $self->session->form->process("captcha","Captcha");
|
||||
unless ($captcha) {
|
||||
return $self->www_edit;
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ Extend the base method to do captcha processing.
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
|
||||
if ($self->isNew && $self->getParent->getValue('useCaptcha')) {
|
||||
if ($self->isNew && $self->getParent->useCaptcha) {
|
||||
my $captchaOk = $self->session->form->process("captcha","Captcha");
|
||||
|
||||
return [ 'invalid captcha' ] unless $captchaOk;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ sub _drawQueryBuilder {
|
|||
# Static form fields
|
||||
my $shortcutCriteriaField = WebGUI::Form::textarea($session, {
|
||||
name=>"shortcutCriteria",
|
||||
value=>$self->getValue("shortcutCriteria"),
|
||||
value=>$self->shortcutCriteria,
|
||||
extras=>'style="width: 100%" '.$self->{_disabled}
|
||||
});
|
||||
my $conjunctionField = WebGUI::Form::selectBox($session, {
|
||||
|
|
@ -307,7 +307,7 @@ sub getEditForm {
|
|||
);
|
||||
}
|
||||
$tabform->getTab("display")->template(
|
||||
-value=>$self->getValue("templateId"),
|
||||
-value=>$self->templateId,
|
||||
-label=>$i18n->get('shortcut template title'),
|
||||
-hoverHelp=>$i18n->get('shortcut template title description'),
|
||||
-namespace=>"Shortcut"
|
||||
|
|
@ -599,7 +599,7 @@ sub getShortcutByCriteria {
|
|||
my $scratchId;
|
||||
if ($assetId) {
|
||||
$scratchId = "Shortcut_" . $assetId;
|
||||
if($self->session->scratch->get($scratchId) && !$self->getValue("disableContentLock")) {
|
||||
if($self->session->scratch->get($scratchId) && !$self->disableContentLock) {
|
||||
unless ($self->session->var->isAdminOn) {
|
||||
return WebGUI::Asset->newById($self->session, $self->session->scratch->get($scratchId));
|
||||
}
|
||||
|
|
@ -729,7 +729,7 @@ Returns an array of profile fields to show to the user as preferences.
|
|||
|
||||
sub getPrefFieldsToShow {
|
||||
my $self = shift;
|
||||
return split("\n",$self->getValue("prefFieldsToShow"));
|
||||
return split("\n",$self->prefFieldsToShow);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -743,7 +743,7 @@ for overrides.
|
|||
|
||||
sub getPrefFieldsToImport {
|
||||
my $self = shift;
|
||||
return split("\n",$self->getValue("prefFieldsToImport"));
|
||||
return split("\n",$self->prefFieldsToImport);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -1136,7 +1136,7 @@ sub www_editOverride {
|
|||
# Cannot fetch the original value from the overrides hash b/c it will be empty if
|
||||
# the override has not been set before. Also getOverrides uses a cached version of
|
||||
# the origValue, which can be out of date.
|
||||
my $origValue = $self->getShortcutOriginal->getValue($fieldName);
|
||||
my $origValue = $self->getShortcutOriginal->$fieldName;
|
||||
|
||||
my $output = '';
|
||||
$output .= '</table>';
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ sub getTaxConfiguration {
|
|||
my $self = shift;
|
||||
my $namespace = shift;
|
||||
|
||||
my $configs = eval { from_json( $self->getValue('taxConfiguration') ) };
|
||||
my $configs = eval { from_json( $self->taxConfiguration ) };
|
||||
if ($@) {
|
||||
$self->session->log->error( 'Tax configuration of asset ' . $self->getId . ' appears to be corrupt. :' . $@ );
|
||||
return undef;
|
||||
|
|
@ -617,7 +617,7 @@ sub setTaxConfiguration {
|
|||
my $configuration = shift;
|
||||
|
||||
# Fetch current tax configurations
|
||||
my $configs = eval { from_json( $self->getValue('taxConfiguration') ) };
|
||||
my $configs = eval { from_json( $self->taxConfiguration ) };
|
||||
if ($@) {
|
||||
$self->session->log->error( 'Tax configuration of asset ' . $self->getId . ' is corrupt.' );
|
||||
return undef;
|
||||
|
|
|
|||
|
|
@ -624,7 +624,7 @@ sub processPropertiesFromFormPost {
|
|||
# TODO: Perhaps add a way to check template syntax before it blows stuff up?
|
||||
my %data;
|
||||
my $needsUpdate = 0;
|
||||
if ($self->getValue("parser") ne $self->session->form->process("parser","className") && ($self->session->form->process("parser","className") ne "")) {
|
||||
if ($self->parser ne $self->session->form->process("parser","className") && ($self->session->form->process("parser","className") ne "")) {
|
||||
$needsUpdate = 1;
|
||||
if (isIn($self->session->form->process("parser","className"),@{$self->session->config->get("templateParsers")})) {
|
||||
%data = ( parser => $self->session->form->process("parser","className") );
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ sub getEditForm {
|
|||
if ( $self->session->setting->get('useMobileStyle') ) {
|
||||
$tabform->getTab("display")->template(
|
||||
name => 'mobileTemplateId',
|
||||
value => $self->getValue('mobileTemplateId'),
|
||||
value => $self->mobileTemplateId,
|
||||
label => $i18n->get('mobileTemplateId label'),
|
||||
hoverHelp => $i18n->get('mobileTemplateId description'),
|
||||
namespace => 'Layout',
|
||||
|
|
|
|||
|
|
@ -98,13 +98,13 @@ sub getEditForm {
|
|||
my $tabform = $self->SUPER::getEditForm;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Navigation");
|
||||
$tabform->getTab("display")->template(
|
||||
-value=>$self->getValue('templateId'),
|
||||
-value=>$self->templateId,
|
||||
-namespace=>"Navigation",
|
||||
-label=>$i18n->get(1096),
|
||||
-hoverHelp=>$i18n->get('1096 description'),
|
||||
);
|
||||
$tabform->getTab("display")->mimeType(
|
||||
-value=>$self->getValue('mimeType'),
|
||||
-value=>$self->mimeType,
|
||||
-name=>"mimeType",
|
||||
-label=>$i18n->get('mimeType'),
|
||||
-hoverHelp=>$i18n->get('mimeType description'),
|
||||
|
|
@ -114,7 +114,7 @@ sub getEditForm {
|
|||
value=>$self->session->form->process("returnUrl")
|
||||
});
|
||||
my ($descendantsChecked, $ancestorsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
|
||||
my @assetsToInclude = split("\n",$self->getValue("assetsToInclude"));
|
||||
my @assetsToInclude = split("\n",$self->assetsToInclude);
|
||||
my $afterScript;
|
||||
foreach my $item (@assetsToInclude) {
|
||||
if ($item eq "self") {
|
||||
|
|
@ -137,7 +137,7 @@ sub getEditForm {
|
|||
relativeToCurrentUrl=>$i18n->get('Relative To Current URL'),
|
||||
relativeToRoot=>$i18n->get('Relative To Root')
|
||||
},
|
||||
-value=>[$self->getValue("startType")],
|
||||
-value=>[$self->startType],
|
||||
-label=>$i18n->get("Start Point Type"),
|
||||
-hoverHelp=>$i18n->get("Start Point Type description"),
|
||||
-id=>"navStartType",
|
||||
|
|
@ -162,7 +162,7 @@ sub getEditForm {
|
|||
'</tbody><tbody id="navAncestorEnd"><tr><td class="formDescription">'.$i18n->get("Ancestor End Point").'</td><td>'
|
||||
.WebGUI::Form::selectBox($self->session,{
|
||||
name=>"ancestorEndPoint",
|
||||
value=>[$self->getValue("ancestorEndPoint")],
|
||||
value=>[$self->ancestorEndPoint],
|
||||
options=>\%options
|
||||
})
|
||||
.'</td></tr></tbody><tbody>'
|
||||
|
|
@ -212,7 +212,7 @@ sub getEditForm {
|
|||
'</tbody><tbody id="navDescendantEnd"><tr><td class="formDescription">'.$i18n->get('Descendant End Point').'</td><td>'
|
||||
.WebGUI::Form::selectBox($self->session,{
|
||||
name=>"descendantEndPoint",
|
||||
value=>[$self->getValue("descendantEndPoint")],
|
||||
value=>[$self->descendantEndPoint],
|
||||
options=>\%options
|
||||
})
|
||||
.'</td></tr></tbody><tbody>'
|
||||
|
|
@ -221,27 +221,27 @@ sub getEditForm {
|
|||
-name=>'showSystemPages',
|
||||
-label=>$i18n->get(30),
|
||||
-hoverHelp=>$i18n->get('30 description'),
|
||||
-value=>$self->getValue("showSystemPages")
|
||||
-value=>$self->showSystemPages
|
||||
);
|
||||
$tabform->getTab("display")->yesNo(
|
||||
-name=>'showHiddenPages',
|
||||
-label=>$i18n->get(31),
|
||||
-hoverHelp=>$i18n->get('31 description'),
|
||||
-value=>$self->getValue("showHiddenPages")
|
||||
-value=>$self->showHiddenPages
|
||||
);
|
||||
$tabform->getTab("display")->yesNo(
|
||||
-name=>'showUnprivilegedPages',
|
||||
-label=>$i18n->get(32),
|
||||
-hoverHelp=>$i18n->get('32 description'),
|
||||
-value=>$self->getValue("showUnprivilegedPages")
|
||||
-value=>$self->showUnprivilegedPages
|
||||
);
|
||||
$tabform->getTab("display")->yesNo(
|
||||
-name=>'reversePageLoop',
|
||||
-label=>$i18n->get('reverse page loop'),
|
||||
-hoverHelp => $i18n->get('reverse page loop description'),
|
||||
-value=>$self->getValue('reversePageLoop'),
|
||||
-value=>$self->reversePageLoop,
|
||||
);
|
||||
my $start = $self->getValue("startPoint");
|
||||
my $start = $self->startPoint;
|
||||
$tabform->getTab("properties")->raw("<script type=\"text/javascript\">
|
||||
//<![CDATA[
|
||||
var displayNavDescendantEndPoint = true;
|
||||
|
|
@ -559,7 +559,7 @@ other types aside from text/html.
|
|||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
my $mimeType = $self->getValue('mimeType') || 'text/html';
|
||||
my $mimeType = $self->mimeType || 'text/html';
|
||||
if ($mimeType eq 'text/html') {
|
||||
return $self->SUPER::www_view();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue