fix getEditForm
This commit is contained in:
parent
1caef590cc
commit
3934a6704c
27 changed files with 357 additions and 809 deletions
|
|
@ -1012,7 +1012,7 @@ sub setupFormField {
|
|||
}
|
||||
|
||||
$tab ||= 'properties';
|
||||
return $tabform->getTab($tab)->dynamicField(%params);
|
||||
return $tabform->getTab($tab)->addField( delete $params{fieldType}, %params);
|
||||
} ## end sub setupFormField
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -596,25 +596,6 @@ sub view {
|
|||
#return $self->processTemplate( $var, undef, $self->{_viewTemplate} );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit ( )
|
||||
|
||||
Web facing method which is the default edit page. Unless the method needs
|
||||
special handling or formatting, it does not need to be included in
|
||||
the module.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
return $session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new( $session, 'Asset_EMSSubmission' );
|
||||
return $self->getAdminConsole->render( $self->getEditForm->print, $i18n->get('edit asset') );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -212,48 +212,25 @@ Returns the TabForm object that will be used in generating the edit page for thi
|
|||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $f = super();
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_File');
|
||||
|
||||
$tabform->getTab("properties")->raw(
|
||||
'<tr><td>'.$i18n->get('new file').'<td colspan="2">'
|
||||
. $self->getEditFormUploadControl
|
||||
. '</td></tr>'
|
||||
);
|
||||
|
||||
return $tabform;
|
||||
};
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getEditFormUploadControl
|
||||
|
||||
Returns the HTML to display the current photo, if it has one, and a file chooser
|
||||
to either upload one, or replace the current one.
|
||||
|
||||
=cut
|
||||
|
||||
sub getEditFormUploadControl {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_File');
|
||||
my $html = '';
|
||||
|
||||
# Add field to upload file
|
||||
if ($self->filename ne "") {
|
||||
$html .= WebGUI::Form::readOnly( $session, {
|
||||
value => '<p style="display:inline;vertical-align:middle;"><a href="'.$self->getFileUrl.'"><img src="'.$self->getFileIconUrl.'" alt="'.$self->filename.'" style="border-style:none;vertical-align:middle;" /> '.$self->filename.'</a></p>'
|
||||
$f->getTab("properties")->addField( "ReadOnly", {
|
||||
name => "viewFile",
|
||||
value => '<p style="display:inline;vertical-align:middle;"><a href="'.$self->getFileUrl.'"><img src="'.$self->getFileIconUrl.'" alt="'.$self->filename.'" style="border-style:none;vertical-align:middle;" /> '.$self->filename.'</a></p>',
|
||||
});
|
||||
}
|
||||
|
||||
# Control to upload a new file
|
||||
$html .= WebGUI::Form::file( $session, {
|
||||
$f->getTab( "properties" )->addField( "File",
|
||||
name => 'newFile',
|
||||
label => $i18n->get('new file'),
|
||||
hoverHelp => $i18n->get('new file description'),
|
||||
});
|
||||
);
|
||||
|
||||
return $html;
|
||||
}
|
||||
return $f;
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -615,13 +592,8 @@ sub www_edit {
|
|||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $tabform = $self->getEditForm;
|
||||
$tabform->getTab("display")->template(
|
||||
-value=>$self->templateId,
|
||||
-hoverHelp=>$i18n->get('file template description','Asset_File'),
|
||||
-namespace=>"FileAsset"
|
||||
);
|
||||
return $self->getAdminConsole->render($tabform->print,$self->addEditLabel);
|
||||
my $f = $self->getEditForm;
|
||||
return $self->getAdminConsole->render($f->print,$self->addEditLabel);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -210,8 +210,7 @@ sub getDownloadFileUrl {
|
|||
=head2 getEditFormUploadControl
|
||||
|
||||
Returns the HTML to display the current photo, if it has one, and a file chooser
|
||||
to either upload one, or replace the current one. Subclasses the master class
|
||||
to change i18n labels.
|
||||
to either upload one, or replace the current one.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -136,51 +136,38 @@ Returns the TabForm object that will be used in generating the edit page for thi
|
|||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
|
||||
# Add the fields defined locally and apply any overrides from the config file
|
||||
my $f = super();
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_Image");
|
||||
|
||||
tie my %extraFields, "Tie::IxHash";
|
||||
# Fix templateId to use correct namespace and default
|
||||
my $template = $f->getTab('display')->getField('templateId');
|
||||
$template->set( hoverHelp => $i18n->get('image template description') );
|
||||
$template->set( namespace => 'ImageAsset' );
|
||||
$template->set( defaultValue => 'PBtmpl0000000000000088' );
|
||||
|
||||
$extraFields{thumbnailSize} = {
|
||||
fieldType => "integer",
|
||||
name => "thumbnailSize",
|
||||
label => $i18n->get('thumbnail size'),
|
||||
hoverHelp => $i18n->get('Thumbnail size description'),
|
||||
value => $self->thumbnailSize,
|
||||
};
|
||||
$extraFields{parameters} = {
|
||||
fieldType => "textarea",
|
||||
name => "parameters",
|
||||
label => $i18n->get('parameters'),
|
||||
hoverHelp => $i18n->get('Parameters description'),
|
||||
value => $self->parameters,
|
||||
};
|
||||
|
||||
# Add the fields defined locally and apply any overrides from the config file
|
||||
my $overrides = $self->session->config->get("assets/".$self->className);
|
||||
|
||||
if ($self->filename ne "") {
|
||||
my ($x, $y) = $self->getStorageLocation->getSizeInPixels($self->filename);
|
||||
|
||||
$extraFields{thumbnail} = {
|
||||
fieldType => "readOnly",
|
||||
$f->getTab('properties')->addField( "ReadOnly",
|
||||
name => 'thumbnail',
|
||||
label => $i18n->get('thumbnail'),
|
||||
hoverHelp => $i18n->get('Thumbnail description'),
|
||||
value => '<a href="'.$self->getFileUrl.'"><img src="'.$self->getThumbnailUrl.'?noCache='.time().'" alt="thumbnail" /></a>'
|
||||
};
|
||||
$extraFields{imageSize} = {
|
||||
fieldType => "readOnly",
|
||||
value => '<a href="'.$self->getFileUrl.'"><img src="'.$self->getThumbnailUrl.'?noCache='.time().'" alt="thumbnail" /></a>',
|
||||
( $overrides->{thumbnail} ? %{$overrides->{thumbnail}} : () ),
|
||||
);
|
||||
$f->getTab('properties')->addField( "ReadOnly",
|
||||
name => 'imageSize',
|
||||
label => $i18n->get('image size'),
|
||||
value => $x.' x '.$y,
|
||||
};
|
||||
( $overrides->{imageSize} ? %{$overrides->{imageSize}} : () ),
|
||||
);
|
||||
}
|
||||
|
||||
my $overrides = $self->session->config->get("assets/".$self->className);
|
||||
|
||||
foreach my $fieldName (keys %extraFields) {
|
||||
$self->setupFormField($tabform, $fieldName, \%extraFields, $overrides);
|
||||
}
|
||||
|
||||
return $tabform;
|
||||
return $f;
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -284,6 +271,7 @@ sub www_edit {
|
|||
my $i18n = WebGUI::International->new($session, 'Asset_Image');
|
||||
if ($self->filename) {
|
||||
my $ac = $self->getAdminConsole;
|
||||
# These are asset helpers now, not functions
|
||||
$ac->addSubmenuItem($self->getUrl('func=resize'), $i18n->get("resize image"));
|
||||
$ac->addSubmenuItem($self->getUrl('func=rotate'), $i18n->get("rotate image"));
|
||||
$ac->addSubmenuItem($self->getUrl('func=crop'), $i18n->get("crop image"));
|
||||
|
|
@ -291,13 +279,7 @@ sub www_edit {
|
|||
$ac->addSubmenuItem($self->getUrl('func=undo'), $i18n->get("undo image"));
|
||||
}
|
||||
my $tabform = $self->getEditForm;
|
||||
$tabform->getTab("display")->template(
|
||||
-value => $self->templateId,
|
||||
-namespace => "ImageAsset",
|
||||
-hoverHelp => $i18n->get('image template description'),
|
||||
-defaultValue => "PBtmpl0000000000000088",
|
||||
);
|
||||
return $self->getAdminConsole->render($tabform->print,$i18n->get("edit image"));
|
||||
return $self->getAdminConsole->render($tabform->toHtml,$i18n->get("edit image"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ sub www_edit {
|
|||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_Wobject');
|
||||
my $addEdit = ($self->session->form->process("func") eq 'add') ? $i18n->get('add') : $i18n->get('edit');
|
||||
return $self->getAdminConsole->render($self->getEditForm->print, $self->addEditLabel);
|
||||
return $self->getAdminConsole->render($self->getEditForm->toHtml, $self->addEditLabel);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ sub getAutoCommitWorkflowId {
|
|||
|
||||
=head2 getEditForm ( )
|
||||
|
||||
Returns the TabForm object that will be used in generating the edit page for this asset.
|
||||
Returns the FormBuilder object that will be used in generating the edit page for this asset.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -210,16 +210,17 @@ sub getEditForm {
|
|||
my $i18n = WebGUI::International->new($session, 'Asset_MatrixListing');
|
||||
my $func = $session->form->process("func");
|
||||
|
||||
# TODO: Change to FormBuilder
|
||||
my $form = WebGUI::HTMLForm->new($session);
|
||||
|
||||
if ($func eq "add" || ( $func eq "editSave" && $session->form->process("assetId") eq "new")) {
|
||||
$form->hidden(
|
||||
-name =>'assetId',
|
||||
-value =>'new',
|
||||
-name => 'assetId',
|
||||
-value => 'new',
|
||||
);
|
||||
$form->hidden(
|
||||
-name =>'class',
|
||||
-value =>'WebGUI::Asset::MatrixListing',
|
||||
-name => 'class',
|
||||
-value => 'WebGUI::Asset::MatrixListing',
|
||||
);
|
||||
}
|
||||
$form->hidden(
|
||||
|
|
@ -232,7 +233,8 @@ sub getEditForm {
|
|||
-label =>$i18n->get("product name label"),
|
||||
-hoverHelp =>$i18n->get('product name description'),
|
||||
-value =>$self->title,
|
||||
);
|
||||
:help grep
|
||||
|
||||
$form->image(
|
||||
-name =>'screenshots',
|
||||
-defaultValue =>undef,
|
||||
|
|
@ -269,7 +271,7 @@ sub getEditForm {
|
|||
-value =>$userId,
|
||||
);
|
||||
}
|
||||
$form->text(
|
||||
$form->text(
|
||||
-name =>'version',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("version label"),
|
||||
|
|
@ -835,6 +837,7 @@ sub www_edit {
|
|||
|
||||
my $var = $self->get;
|
||||
my $matrix = $self->getParent;
|
||||
# TODO: Change to FormBuilder
|
||||
$var->{form} = $self->getEditForm->print;
|
||||
|
||||
return $matrix->processStyle($self->processTemplate($var,$matrix->get("editListingTemplateId")));
|
||||
|
|
@ -929,7 +932,7 @@ sub www_getScreenshots {
|
|||
<thumb_source>".$storage->getUrl($thumb)."</thumb_source>
|
||||
<width>".$width."</width>
|
||||
<height>".$height."</height>
|
||||
</slide>
|
||||
</slide>
|
||||
";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,242 +205,128 @@ Returns the TabForm object that will be used in generating the edit page for thi
|
|||
=cut
|
||||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $i18n = WebGUI::International->new($self->session,'Asset_RichEdit');
|
||||
my %buttons;
|
||||
tie %buttons, "Tie::IxHash";
|
||||
%buttons = (
|
||||
'search' => $i18n->get('search'),
|
||||
'replace' => $i18n->get('replace'),
|
||||
'cut' => $i18n->get('cut'),
|
||||
'copy' => $i18n->get('Copy'),
|
||||
'paste' => $i18n->get('paste'),
|
||||
'pastetext' => $i18n->get('pastetext'),
|
||||
'pasteword' => $i18n->get('pasteword'),
|
||||
'undo' => $i18n->get('undo'),
|
||||
'redo' => $i18n->get('redo'),
|
||||
'bold' => $i18n->get('bold'),
|
||||
'italic' => $i18n->get('italic'),
|
||||
'underline' => $i18n->get('underline'),
|
||||
'strikethrough' => $i18n->get('strikethrough'),
|
||||
'justifyleft' => $i18n->get('justifyleft'),
|
||||
'justifycenter' => $i18n->get('justifycenter'),
|
||||
'justifyright' => $i18n->get('justifyright'),
|
||||
'justifyfull' => $i18n->get('justifyfull'),
|
||||
'bullist' => $i18n->get('bullist'),
|
||||
'numlist' => $i18n->get('numlist'),
|
||||
'outdent' => $i18n->get('outdent'),
|
||||
'indent' => $i18n->get('indent'),
|
||||
'sub' => $i18n->get('sub'),
|
||||
'sup' => $i18n->get('sup'),
|
||||
'styleselect' => $i18n->get('styleselect'),
|
||||
'formatselect' => $i18n->get('formatselect'),
|
||||
'fontselect' => $i18n->get('fontselect'),
|
||||
'fontsizeselect' => $i18n->get('fontsizeselect'),
|
||||
'forecolor' => $i18n->get('forecolor'),
|
||||
'backcolor' => $i18n->get('backcolor'),
|
||||
'link' => $i18n->get('link'),
|
||||
'wgpagetree' => $i18n->get('pagetree'),
|
||||
'anchor' => $i18n->get('anchor'),
|
||||
'unlink' => $i18n->get('unlink'),
|
||||
'tablecontrols' => $i18n->get('tablecontrols'),
|
||||
'visualaid' => $i18n->get('visualaid'),
|
||||
'hr' => $i18n->get('hr'),
|
||||
'advhr' => $i18n->get('advhr'),
|
||||
'inserttime' => $i18n->get('inserttime'),
|
||||
'insertdate' => $i18n->get('insertdate'),
|
||||
'image' => $i18n->get('image'),
|
||||
'wginsertimage' => $i18n->get('insertImage'),
|
||||
'media' => $i18n->get('media'),
|
||||
'charmap' => $i18n->get('charmap'),
|
||||
'wgmacro' => $i18n->get('collateral'),
|
||||
'emotions' => $i18n->get('emotions'),
|
||||
'help' => $i18n->get('help'),
|
||||
'iespell' => $i18n->get('iespell'),
|
||||
'removeformat' => $i18n->get('removeformat'),
|
||||
'code' => $i18n->get('code'),
|
||||
'cleanup' => $i18n->get('cleanup'),
|
||||
'save' => $i18n->get('save'),
|
||||
'preview' => $i18n->get('preview'),
|
||||
'fullscreen' => $i18n->get('fullscreen'),
|
||||
'print' => $i18n->get('print'),
|
||||
'spellchecker' => $i18n->get('Server Side Spell Checker'),
|
||||
# 'advlink' => "Advanced Link",
|
||||
# 'spacer' => "Toolbar Spacer",
|
||||
# 'separator' => "Toolbar Separator",
|
||||
# 'rowseparator' => "Toolbar Row Separator",
|
||||
# 'advimage' => "Advanced Image",
|
||||
);
|
||||
my $buttonGrid = sprintf qq!<table style="font-size: 11px;">
|
||||
<tr style="font-weight: bold;">
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td></td>
|
||||
</tr>!,
|
||||
$i18n->get('button'),
|
||||
$i18n->get('row 1'),
|
||||
$i18n->get('row 2'),
|
||||
$i18n->get('row 3');
|
||||
my @toolbarRow1 = split("\n",$self->toolbarRow1);
|
||||
my @toolbarRow2 = split("\n",$self->toolbarRow2);
|
||||
my @toolbarRow3 = split("\n",$self->toolbarRow3);
|
||||
my $evenOddToggle = 0;
|
||||
foreach my $key (keys %buttons) {
|
||||
$evenOddToggle = $evenOddToggle ? 0 : 1;
|
||||
my $checked1 = isIn($key,@toolbarRow1);
|
||||
my $checked2 = isIn($key,@toolbarRow2);
|
||||
my $checked3 = isIn($key,@toolbarRow3);
|
||||
$buttonGrid .= '
|
||||
<tr'.($evenOddToggle ? ' style="background-color: #eeeeee;"' : undef).'>
|
||||
<td>'.$buttons{$key}.'</td>
|
||||
<td>'.WebGUI::Form::checkbox($self->session, {
|
||||
value=>$key,
|
||||
name=>"toolbarRow1",
|
||||
checked=>$checked1
|
||||
}).'</td>
|
||||
<td>'.WebGUI::Form::checkbox($self->session, {
|
||||
value=>$key,
|
||||
name=>"toolbarRow2",
|
||||
checked=>$checked2
|
||||
}).'</td>
|
||||
<td>'.WebGUI::Form::checkbox($self->session, {
|
||||
value=>$key,
|
||||
name=>"toolbarRow3",
|
||||
checked=>$checked3
|
||||
}).'</td><td>';
|
||||
if ($key eq 'spellchecker' && !($self->session->config->get('availableDictionaries'))) {
|
||||
$buttonGrid .= $i18n->get('no dictionaries');
|
||||
}
|
||||
$buttonGrid .= '</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$buttonGrid .= "</table>";
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-label=>$i18n->get('toolbar buttons'),
|
||||
-hoverHelp=>$i18n->get('toolbar buttons description'),
|
||||
-value=>$buttonGrid
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->disableRichEditor,
|
||||
-label=>$i18n->get('disable rich edit'),
|
||||
-hoverHelp=>$i18n->get('disable rich edit description'),
|
||||
-name=>"disableRichEditor"
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->getValue("askAboutRichEdit"),
|
||||
-label=>$i18n->get('using rich edit'),
|
||||
-hoverHelp=>$i18n->get('using rich edit description'),
|
||||
-name=>"askAboutRichEdit"
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->getValue("preformatted"),
|
||||
-label=>$i18n->get('preformatted'),
|
||||
-hoverHelp=>$i18n->get('preformatted description'),
|
||||
-name=>"preformatted",
|
||||
-uiLevel=>9
|
||||
);
|
||||
$tabform->getTab("security")->textarea(
|
||||
-value=>$self->getValue("validElements"),
|
||||
-name=>"validElements",
|
||||
-label=>$i18n->get('elements'),
|
||||
-hoverHelp=>$i18n->get('elements description'),
|
||||
-subtext=>$i18n->get('elements subtext'),
|
||||
-uiLevel=>9
|
||||
);
|
||||
$tabform->getTab("display")->integer(
|
||||
-value=>$self->getValue("editorHeight"),
|
||||
-label=>$i18n->get('editor height'),
|
||||
-hoverHelp=>$i18n->get('editor height description'),
|
||||
-name=>"editorHeight",
|
||||
-uiLevel=>9
|
||||
);
|
||||
$tabform->getTab("display")->integer(
|
||||
-value=>$self->getValue("editorWidth"),
|
||||
-label=>$i18n->get('editor width'),
|
||||
-hoverHelp=>$i18n->get('editor width description'),
|
||||
-name=>"editorWidth",
|
||||
-uiLevel=>9
|
||||
);
|
||||
$tabform->getTab("display")->integer(
|
||||
-value=>$self->getValue("sourceEditorHeight"),
|
||||
-label=>$i18n->get('source editor height'),
|
||||
-hoverHelp=>$i18n->get('source editor height description'),
|
||||
-name=>"sourceEditorHeight"
|
||||
);
|
||||
$tabform->getTab("display")->integer(
|
||||
-value=>$self->getValue("sourceEditorWidth"),
|
||||
-label=>$i18n->get('source editor width'),
|
||||
-hoverHelp=>$i18n->get('source editor width description'),
|
||||
-name=>"sourceEditorWidth"
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->getValue("useBr"),
|
||||
-label=>$i18n->get('use br'),
|
||||
-hoverHelp=>$i18n->get('use br description'),
|
||||
-name=>"useBr",
|
||||
-uiLevel=>9
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->getValue("removeLineBreaks"),
|
||||
-label=>$i18n->get('remove line breaks'),
|
||||
-hoverHelp=>$i18n->get('remove line breaks description'),
|
||||
-name=>"removeLineBreaks",
|
||||
-uiLevel=>9
|
||||
);
|
||||
$tabform->getTab("display")->yesNo(
|
||||
-value=>$self->getValue("nowrap"),
|
||||
-label=>$i18n->get('no wrap'),
|
||||
-hoverHelp=>$i18n->get('no wrap description'),
|
||||
-name=>"nowrap",
|
||||
-uiLevel=>9
|
||||
);
|
||||
$tabform->getTab("properties")->selectBox(
|
||||
-value=>[$self->getValue("directionality")],
|
||||
-label=>$i18n->get('directionality'),
|
||||
-hoverHelp=>$i18n->get('directionality description'),
|
||||
-name=>"directionality",
|
||||
-options=>{
|
||||
}
|
||||
);
|
||||
$tabform->getTab("display")->selectBox(
|
||||
-value=>[$self->getValue("toolbarLocation")],
|
||||
-label=>$i18n->get('toolbar location'),
|
||||
-hoverHelp=>$i18n->get('toolbar location description'),
|
||||
-name=>"toolbarLocation",
|
||||
-options=>{
|
||||
top=>$i18n->get('top'),
|
||||
bottom=>$i18n->get('bottom'),
|
||||
}
|
||||
);
|
||||
$tabform->getTab("properties")->text(
|
||||
-value=>$self->getValue("cssFile"),
|
||||
-label=>$i18n->get('css file'),
|
||||
-hoverHelp=>$i18n->get('css file description'),
|
||||
-name=>"cssFile"
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->getValue("enableContextMenu"),
|
||||
-label=>$i18n->get('enable context menu'),
|
||||
-hoverHelp=>$i18n->get('enable context menu description'),
|
||||
-name=>"enableContextMenu"
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->getValue("inlinePopups"),
|
||||
-label=>$i18n->get('inline popups'),
|
||||
-hoverHelp=>$i18n->get('inline popups description'),
|
||||
-name=>"inlinePopups"
|
||||
my $self = shift;
|
||||
my $f = super();
|
||||
my $i18n = WebGUI::International->new($self->session,'Asset_RichEdit');
|
||||
my %buttons;
|
||||
tie %buttons, "Tie::IxHash";
|
||||
%buttons = (
|
||||
'search' => $i18n->get('search'),
|
||||
'replace' => $i18n->get('replace'),
|
||||
'cut' => $i18n->get('cut'),
|
||||
'copy' => $i18n->get('Copy'),
|
||||
'paste' => $i18n->get('paste'),
|
||||
'pastetext' => $i18n->get('pastetext'),
|
||||
'pasteword' => $i18n->get('pasteword'),
|
||||
'undo' => $i18n->get('undo'),
|
||||
'redo' => $i18n->get('redo'),
|
||||
'bold' => $i18n->get('bold'),
|
||||
'italic' => $i18n->get('italic'),
|
||||
'underline' => $i18n->get('underline'),
|
||||
'strikethrough' => $i18n->get('strikethrough'),
|
||||
'justifyleft' => $i18n->get('justifyleft'),
|
||||
'justifycenter' => $i18n->get('justifycenter'),
|
||||
'justifyright' => $i18n->get('justifyright'),
|
||||
'justifyfull' => $i18n->get('justifyfull'),
|
||||
'bullist' => $i18n->get('bullist'),
|
||||
'numlist' => $i18n->get('numlist'),
|
||||
'outdent' => $i18n->get('outdent'),
|
||||
'indent' => $i18n->get('indent'),
|
||||
'sub' => $i18n->get('sub'),
|
||||
'sup' => $i18n->get('sup'),
|
||||
'styleselect' => $i18n->get('styleselect'),
|
||||
'formatselect' => $i18n->get('formatselect'),
|
||||
'fontselect' => $i18n->get('fontselect'),
|
||||
'fontsizeselect' => $i18n->get('fontsizeselect'),
|
||||
'forecolor' => $i18n->get('forecolor'),
|
||||
'backcolor' => $i18n->get('backcolor'),
|
||||
'link' => $i18n->get('link'),
|
||||
'wgpagetree' => $i18n->get('pagetree'),
|
||||
'anchor' => $i18n->get('anchor'),
|
||||
'unlink' => $i18n->get('unlink'),
|
||||
'tablecontrols' => $i18n->get('tablecontrols'),
|
||||
'visualaid' => $i18n->get('visualaid'),
|
||||
'hr' => $i18n->get('hr'),
|
||||
'advhr' => $i18n->get('advhr'),
|
||||
'inserttime' => $i18n->get('inserttime'),
|
||||
'insertdate' => $i18n->get('insertdate'),
|
||||
'image' => $i18n->get('image'),
|
||||
'wginsertimage' => $i18n->get('insertImage'),
|
||||
'media' => $i18n->get('media'),
|
||||
'charmap' => $i18n->get('charmap'),
|
||||
'wgmacro' => $i18n->get('collateral'),
|
||||
'emotions' => $i18n->get('emotions'),
|
||||
'help' => $i18n->get('help'),
|
||||
'iespell' => $i18n->get('iespell'),
|
||||
'removeformat' => $i18n->get('removeformat'),
|
||||
'code' => $i18n->get('code'),
|
||||
'cleanup' => $i18n->get('cleanup'),
|
||||
'save' => $i18n->get('save'),
|
||||
'preview' => $i18n->get('preview'),
|
||||
'fullscreen' => $i18n->get('fullscreen'),
|
||||
'print' => $i18n->get('print'),
|
||||
'spellchecker' => $i18n->get('Server Side Spell Checker'),
|
||||
# 'advlink' => "Advanced Link",
|
||||
# 'spacer' => "Toolbar Spacer",
|
||||
# 'separator' => "Toolbar Separator",
|
||||
# 'rowseparator' => "Toolbar Row Separator",
|
||||
# 'advimage' => "Advanced Image",
|
||||
);
|
||||
my $buttonGrid = sprintf qq!<table style="font-size: 11px;">
|
||||
<tr style="font-weight: bold;">
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td></td>
|
||||
</tr>!,
|
||||
$i18n->get('button'),
|
||||
$i18n->get('row 1'),
|
||||
$i18n->get('row 2'),
|
||||
$i18n->get('row 3');
|
||||
my @toolbarRow1 = split("\n",$self->toolbarRow1);
|
||||
my @toolbarRow2 = split("\n",$self->toolbarRow2);
|
||||
my @toolbarRow3 = split("\n",$self->toolbarRow3);
|
||||
my $evenOddToggle = 0;
|
||||
foreach my $key (keys %buttons) {
|
||||
$evenOddToggle = $evenOddToggle ? 0 : 1;
|
||||
my $checked1 = isIn($key,@toolbarRow1);
|
||||
my $checked2 = isIn($key,@toolbarRow2);
|
||||
my $checked3 = isIn($key,@toolbarRow3);
|
||||
$buttonGrid .= '
|
||||
<tr'.($evenOddToggle ? ' style="background-color: #eeeeee;"' : undef).'>
|
||||
<td>'.$buttons{$key}.'</td>
|
||||
<td>'.WebGUI::Form::checkbox($self->session, {
|
||||
value=>$key,
|
||||
name=>"toolbarRow1",
|
||||
checked=>$checked1
|
||||
}).'</td>
|
||||
<td>'.WebGUI::Form::checkbox($self->session, {
|
||||
value=>$key,
|
||||
name=>"toolbarRow2",
|
||||
checked=>$checked2
|
||||
}).'</td>
|
||||
<td>'.WebGUI::Form::checkbox($self->session, {
|
||||
value=>$key,
|
||||
name=>"toolbarRow3",
|
||||
checked=>$checked3
|
||||
}).'</td><td>';
|
||||
if ($key eq 'spellchecker' && !($self->session->config->get('availableDictionaries'))) {
|
||||
$buttonGrid .= $i18n->get('no dictionaries');
|
||||
}
|
||||
$buttonGrid .= '</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$buttonGrid .= "</table>";
|
||||
my $tab = $f->addTab(name => "buttons", label => $i18n->get("buttons") );
|
||||
$tab->addField( "ReadOnly",
|
||||
label => $i18n->get('toolbar buttons'),
|
||||
hoverHelp => $i18n->get('toolbar buttons description'),
|
||||
value => $buttonGrid,
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
value => $self->allowMedia,
|
||||
label => $i18n->get('editForm allowMedia label'),
|
||||
hoverHelp => $i18n->get('editForm allowMedia description'),
|
||||
name => "allowMedia",
|
||||
);
|
||||
return $tabform;
|
||||
|
||||
return $f;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -288,74 +288,69 @@ Extend the base class to handle hand drawing the query build and other pieces.
|
|||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $f = super();
|
||||
my $originalTemplate;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut");
|
||||
my $shortcut = $self->getShortcut;
|
||||
if (defined $shortcut) {
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-label=>$i18n->get(1),
|
||||
-hoverHelp=>$i18n->get('1 description'),
|
||||
-value=>'<a href="'.$shortcut->getUrl.'">'.$shortcut->get('title').'</a> ('.$shortcut->getId.')'
|
||||
$f->getTab("properties")->addField( "ReadOnly",
|
||||
label=>$i18n->get(1),
|
||||
hoverHelp=>$i18n->get('1 description'),
|
||||
value=>'<a href="'.$shortcut->getUrl.'">'.$shortcut->get('title').'</a> ('.$shortcut->getId.')'
|
||||
);
|
||||
} else {
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
$f->getTab("properties")->addField( "ReadOnly",
|
||||
value=>'<a href="'.$self->getUrl("func=delete").'"><span style="font-weight: bold; color: red;">'.$self->notLinked.'</span></a>'
|
||||
);
|
||||
}
|
||||
$tabform->getTab("display")->template(
|
||||
-value=>$self->templateId,
|
||||
-label=>$i18n->get('shortcut template title'),
|
||||
-hoverHelp=>$i18n->get('shortcut template title description'),
|
||||
-namespace=>"Shortcut"
|
||||
);
|
||||
|
||||
if($self->session->setting->get("metaDataEnabled")) {
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-name => "shortcutByCriteria",
|
||||
-value => $self->getValue("shortcutByCriteria"),
|
||||
-label => $i18n->get("Shortcut by alternate criteria"),
|
||||
-hoverHelp=> $i18n->get("Shortcut by alternate criteria description"),
|
||||
-extras => q|onchange="wgCriteriaDisable(this.form, this.form.shortcutByCriteria[0].checked)"|,
|
||||
$f->getTab("properties")->addField( "YesNo",
|
||||
name => "shortcutByCriteria",
|
||||
value => $self->getValue("shortcutByCriteria"),
|
||||
label => $i18n->get("Shortcut by alternate criteria"),
|
||||
hoverHelp=> $i18n->get("Shortcut by alternate criteria description"),
|
||||
extras => q|onchange="wgCriteriaDisable(this.form, this.form.shortcutByCriteria[0].checked)"|,
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-name=>"disableContentLock",
|
||||
-value=>$self->getValue("disableContentLock"),
|
||||
-label=>$i18n->get("disable content lock"),
|
||||
-hoverHelp=>$i18n->get("disable content lock description")
|
||||
$f->getTab("properties")->addField( "YesNo",
|
||||
name=>"disableContentLock",
|
||||
value=>$self->getValue("disableContentLock"),
|
||||
label=>$i18n->get("disable content lock"),
|
||||
hoverHelp=>$i18n->get("disable content lock description"),
|
||||
);
|
||||
if ($self->getValue("shortcutByCriteria") == 0) {
|
||||
$self->{_disabled} = 'disabled=true';
|
||||
}
|
||||
$tabform->getTab("properties")->selectBox(
|
||||
-name=>"resolveMultiples",
|
||||
-value=>[ $self->getValue("resolveMultiples") ],
|
||||
-label=>$i18n->get("Resolve Multiples"),
|
||||
-hoverHelp=>$i18n->get("Resolve Multiples description"),
|
||||
-options=>{
|
||||
$f->getTab("properties")->addField( "SelectBox",
|
||||
name=>"resolveMultiples",
|
||||
value=>[ $self->getValue("resolveMultiples") ],
|
||||
label=>$i18n->get("Resolve Multiples"),
|
||||
hoverHelp=>$i18n->get("Resolve Multiples description"),
|
||||
options=>{
|
||||
mostRecent=>$i18n->get("Most Recent"),
|
||||
random=>$i18n->get("Random"),
|
||||
},
|
||||
-extras=>$self->{_disabled}
|
||||
extras=>$self->{_disabled},
|
||||
);
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-value=>$self->_drawQueryBuilder(),
|
||||
-label=>$i18n->get("Criteria"),
|
||||
-hoverHelp=>$i18n->get("Criteria description")
|
||||
$f->getTab("properties")->addField( "ReadOnly",
|
||||
value=>$self->_drawQueryBuilder(),
|
||||
label=>$i18n->get("Criteria"),
|
||||
hoverHelp=>$i18n->get("Criteria description"),
|
||||
);
|
||||
}
|
||||
$tabform->addTab('overrides',$i18n->get('Overrides'));
|
||||
$tabform->getTab('overrides')->raw('<tr><td>' . $self->getOverridesList . '</td></tr>');
|
||||
$f->addTab( name => 'overrides', label => $i18n->get('Overrides') );
|
||||
$f->getTab('overrides')->addField( "ReadOnly", value => $self->getOverridesList );
|
||||
if ($self->isDashlet) {
|
||||
$tabform->addTab('preferences',$i18n->get('Preferences'), 9);
|
||||
$tabform->getTab('preferences')->raw($self->getFieldsList);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-value=>$self->getValue("showReloadIcon"),
|
||||
-name=>"showReloadIcon",
|
||||
-label=>$i18n->get("show reload icon"),
|
||||
-hoverHelp=>$i18n->get("show reload icon description")
|
||||
$f->addTab('preferences',$i18n->get('Preferences'), 9);
|
||||
$f->getTab('preferences')->addField( "ReadOnly", value => $self->getFieldsList );
|
||||
$f->getTab("properties")->addField( "YesNo",
|
||||
value=>$self->getValue("showReloadIcon"),
|
||||
name=>"showReloadIcon",
|
||||
label=>$i18n->get("show reload icon"),
|
||||
hoverHelp=>$i18n->get("show reload icon description"),
|
||||
);
|
||||
}
|
||||
return $tabform;
|
||||
return $f;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -948,7 +943,7 @@ sub www_edit {
|
|||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
|
||||
$self->getAdminConsole->addSubmenuItem($self->getUrl("func=manageOverrides"),$i18n->get("Manage Shortcut Overrides"));
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get(2));
|
||||
return $self->getAdminConsole->render($self->getEditForm->toHtml,$i18n->get(2));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -194,22 +194,22 @@ override getEditForm => sub {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my $tabform = super();
|
||||
my $form = super();
|
||||
|
||||
my $taxDriver = WebGUI::Shop::Tax->getDriver( $session );
|
||||
my $definition = $taxDriver->skuFormDefinition;
|
||||
my $config = $self->getTaxConfiguration( $taxDriver->className );
|
||||
my $shop = $tabform->getTab( 'shop' );
|
||||
my $shop = $form->getTab( 'shop' );
|
||||
|
||||
foreach my $fieldName ( keys %{ $definition } ) {
|
||||
$shop->dynamicField(
|
||||
$shop->addField( "DynamicField",
|
||||
%{ $definition->{ $fieldName } },
|
||||
name => $fieldName,
|
||||
value => $config->{ $fieldName },
|
||||
);
|
||||
}
|
||||
|
||||
return $tabform;
|
||||
return $form;
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ sub www_edit {
|
|||
</style>
|
||||
|);
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_EventManagementSystem");
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems badge').'</h1>'.$self->getEditForm->print);
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems badge').'</h1>'.$self->getEditForm->toHtml);
|
||||
}
|
||||
|
||||
__PACKAGE__->meta->make_immutable;
|
||||
|
|
|
|||
|
|
@ -269,8 +269,8 @@ sub www_edit {
|
|||
|);
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_EventManagementSystem");
|
||||
my $form = $self->getEditForm;
|
||||
$form->hidden({name=>'proceed', value=>'viewAll'});
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems ribbon').'</h1>'.$form->print);
|
||||
$form->addField( "hidden", name=>'proceed', value=>'viewAll', );
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems ribbon').'</h1>'.$form->toHtml);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -250,15 +250,15 @@ Extended to support event metadata.
|
|||
|
||||
=cut
|
||||
|
||||
sub getEditForm {
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $form = $self->SUPER::getEditForm(@_);
|
||||
my $form = super();
|
||||
my $metadata = $self->getEventMetaData;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_EventManagementSystem");
|
||||
my $date = WebGUI::DateTime->new($self->session, time());
|
||||
|
||||
foreach my $field (@{$self->getParent->getEventMetaFields}) {
|
||||
$form->getTab("meta")->DynamicField(
|
||||
$form->getTab("meta")->addField( "DynamicField",
|
||||
name => "eventmeta ".$field->{label},
|
||||
value => $metadata->{$field->{label}},
|
||||
defaultValue => $field->{defaultValues},
|
||||
|
|
@ -267,7 +267,7 @@ sub getEditForm {
|
|||
label => $field->{label},
|
||||
);
|
||||
}
|
||||
$form->getTab("properties")->DateTime(
|
||||
$form->getTab("properties")->addField( "DateTime",
|
||||
name => "startDate",
|
||||
label => $i18n->get("add/edit event start date"),
|
||||
hoverHelp => $i18n->get("add/edit event start date help"),
|
||||
|
|
@ -572,8 +572,8 @@ sub www_edit {
|
|||
|);
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_EventManagementSystem");
|
||||
my $form = $self->getEditForm;
|
||||
$form->hidden({name=>'proceed', value=>'viewAll'});
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems ticket').'</h1>'.$form->print);
|
||||
$form->addField( "hidden", name=>'proceed', value=>'viewAll');
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems ticket').'</h1>'.$form->toHtml);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -263,8 +263,8 @@ sub www_edit {
|
|||
|);
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_EventManagementSystem");
|
||||
my $form = $self->getEditForm;
|
||||
$form->hidden({name=>'proceed', value=>'viewAll'});
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems token').'</h1>'.$form->print);
|
||||
$form->addField( "hidden", name=>'proceed', value=>'viewAll');
|
||||
return $self->processStyle('<h1>'.$i18n->get('ems token').'</h1>'.$form->toHtml);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -237,49 +237,27 @@ override getEditForm => sub {
|
|||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_Template');
|
||||
$tabform->hidden({
|
||||
$tabform->addField( "hidden",
|
||||
name=>"returnUrl",
|
||||
value=>$self->session->form->get("returnUrl")
|
||||
});
|
||||
);
|
||||
if ($self->namespace eq "") {
|
||||
my $namespaces = $self->session->dbSlave->buildHashRef("select distinct(namespace) from template order by namespace");
|
||||
$tabform->getTab("properties")->combo(
|
||||
-name=>"namespace",
|
||||
-options=>$namespaces,
|
||||
-label=>$i18n->get('namespace'),
|
||||
-hoverHelp=>$i18n->get('namespace description'),
|
||||
-value=>[$self->session->form->get("namespace")]
|
||||
$tabform->getTab("properties")->addField( "combo",
|
||||
name=>"namespace",
|
||||
options=>$namespaces,
|
||||
label=>$i18n->get('namespace'),
|
||||
hoverHelp=>$i18n->get('namespace description'),
|
||||
value=>[$self->session->form->get("namespace")]
|
||||
);
|
||||
} else {
|
||||
$tabform->getTab("meta")->readOnly(
|
||||
-label=>$i18n->get('namespace'),
|
||||
-hoverHelp=>$i18n->get('namespace description'),
|
||||
-value=>$self->namespace
|
||||
);
|
||||
$tabform->getTab("meta")->hidden(
|
||||
-name=>"namespace",
|
||||
-value=>$self->namespace
|
||||
$tabform->getTab("meta")->addField( "ReadOnly",
|
||||
name=>"namespace",
|
||||
label=>$i18n->get('namespace'),
|
||||
hoverHelp=>$i18n->get('namespace description'),
|
||||
value=>$self->namespace
|
||||
);
|
||||
}
|
||||
$tabform->getTab("display")->yesNo(
|
||||
-name=>"showInForms",
|
||||
-value=>$self->showInForms,
|
||||
-label=>$i18n->get('show in forms'),
|
||||
-hoverHelp=>$i18n->get('show in forms description'),
|
||||
);
|
||||
$tabform->getTab("properties")->codearea(
|
||||
-name=>"template",
|
||||
-label=>$i18n->get('assetName'),
|
||||
-hoverHelp=>$i18n->get('template description'),
|
||||
-syntax => "html",
|
||||
-value=>$self->template
|
||||
);
|
||||
$tabform->getTab('properties')->yesNo(
|
||||
name => "usePacked",
|
||||
label => $i18n->get('usePacked label'),
|
||||
hoverHelp => $i18n->get('usePacked description'),
|
||||
value => $self->usePacked,
|
||||
);
|
||||
if($self->session->config->get("templateParsers")){
|
||||
my @temparray = @{$self->session->config->get("templateParsers")};
|
||||
tie my %parsers, 'Tie::IxHash';
|
||||
|
|
@ -288,12 +266,12 @@ override getEditForm => sub {
|
|||
}
|
||||
my $value = [$self->getValue("parser")];
|
||||
$value = \[$self->session->config->get("defaultTemplateParser")] if(!$self->parser);
|
||||
$tabform->getTab("properties")->selectBox(
|
||||
-name=>"parser",
|
||||
-options=>\%parsers,
|
||||
-value=>$value,
|
||||
-label=>$i18n->get('parser'),
|
||||
-hoverHelp=>$i18n->get('parser description'),
|
||||
$tabform->getTab("properties")->addField( "SelectBox",
|
||||
name=>"parser",
|
||||
options=>\%parsers,
|
||||
value=>$value,
|
||||
label=>$i18n->get('parser'),
|
||||
hoverHelp=>$i18n->get('parser description'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -688,7 +666,7 @@ ENDHTML
|
|||
;
|
||||
}
|
||||
|
||||
$output .= $self->getEditForm->print;
|
||||
$output .= $self->getEditForm->toHtml;
|
||||
|
||||
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=styleWizard'),$i18n->get("style wizard")) if ($self->get("namespace") eq "style");
|
||||
return $self->getAdminConsole->render( $output, $i18n->get('edit template') );
|
||||
|
|
|
|||
|
|
@ -1675,7 +1675,7 @@ sub www_edit {
|
|||
|
||||
|
||||
return $self->getAdminConsole->render(
|
||||
$self->getEditForm->print,
|
||||
$self->getEditForm->toHtml,
|
||||
$i18n->get("assetName")
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1641,7 +1641,7 @@ sub www_edit {
|
|||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_Collaboration');
|
||||
$self->getAdminConsole->addConfirmedSubmenuItem($self->getUrl('func=unarchiveAll'),$i18n->get("unarchive all"),$i18n->get("unarchive confirm"));
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get("assetName"));
|
||||
return $self->getAdminConsole->render($self->getEditForm->toHtml,$i18n->get("assetName"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ define assetName => ['assetName', 'Asset_DataTable'];
|
|||
define icon => 'DataTable.gif';
|
||||
define tableName => 'DataTable';
|
||||
property data => (
|
||||
tab => "data",
|
||||
fieldType => 'DataTable',
|
||||
default => undef,
|
||||
label => '',
|
||||
|
|
@ -119,50 +120,6 @@ sub getDataTemplateVars {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getEditForm ( )
|
||||
|
||||
Add the data table to the edit form.
|
||||
|
||||
=cut
|
||||
|
||||
# TODO Get the DataSource's edit form
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
|
||||
$tabform->getTab("data")->raw(
|
||||
q{<tr><td>}
|
||||
. WebGUI::Form::DataTable->new(
|
||||
$self->session, {
|
||||
name => "data",
|
||||
value => $self->data,
|
||||
defaultValue => undef,
|
||||
showEdit => 1,
|
||||
}
|
||||
)->toHtml
|
||||
. q{</td></tr>}
|
||||
);
|
||||
|
||||
return $tabform;
|
||||
}; ## end sub getEditForm
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getEditTabs ( )
|
||||
|
||||
Add a tab for the data table.
|
||||
|
||||
override getEditTabs => sub {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new( $self->session, "Asset_DataTable" );
|
||||
|
||||
return ( super(), [ "data" => $i18n->get("tab label data") ], );
|
||||
};
|
||||
|
||||
=cut
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getTemplateVars ( )
|
||||
|
||||
Get the template vars for this asset.
|
||||
|
|
|
|||
|
|
@ -119,30 +119,6 @@ sub getContentLastModified {
|
|||
return $mtime;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getEditForm ( )
|
||||
|
||||
Returns the TabForm object that will be used in generating the edit page for this asset.
|
||||
|
||||
=cut
|
||||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_Folder");
|
||||
if ($self->assetId eq "new") {
|
||||
$tabform->getTab("properties")->whatNext(
|
||||
-options=>{
|
||||
view=>$i18n->get(823),
|
||||
"viewParent"=>$i18n->get(847)
|
||||
},
|
||||
-value=>"view"
|
||||
);
|
||||
}
|
||||
return $tabform;
|
||||
};
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getTemplateVars ( )
|
||||
|
|
|
|||
|
|
@ -34,29 +34,35 @@ property templateId => (
|
|||
hoverHelp => ['template description', 'Asset_Layout'],
|
||||
);
|
||||
property mobileTemplateId => (
|
||||
#fieldType => ( $session->style->useMobileStyle ? 'template' : 'hidden' ),
|
||||
tab => "display",
|
||||
fieldType => 'template',
|
||||
namespace => 'Layout',
|
||||
default => 'PBtmpl0000000000000054',
|
||||
label => ['mobileTemplateId label', 'Asset_Layout'],
|
||||
hoverHelp => ['mobileTemplateId description', 'Asset_Layout'],
|
||||
noFormPost => 1,
|
||||
);
|
||||
property contentPositions => (
|
||||
noFormPost => 1,
|
||||
default => undef,
|
||||
fieldType => "hidden",
|
||||
noFormPost => 1,
|
||||
);
|
||||
property assetsToHide => (
|
||||
tab => "properties",
|
||||
default => undef,
|
||||
fieldType => "checkList",
|
||||
noFormPost => 1,
|
||||
label => ['assets to hide', 'Asset_Layout'],
|
||||
hoverHelp => ['assets to hide description', 'Asset_Layout'],
|
||||
options => sub { },
|
||||
vertical => 1,
|
||||
uiLevel => 9,
|
||||
options => sub {
|
||||
my @assetsToHide = split("\n",$self->assetsToHide);
|
||||
my $children = $self->getLineage(["children"],{"returnObjects"=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"]});
|
||||
my %childIds;
|
||||
foreach my $child (@{$children}) {
|
||||
$childIds{$child->getId} = $child->getTitle;
|
||||
}
|
||||
return \%childIds;
|
||||
},
|
||||
);
|
||||
property assetOrder => (
|
||||
tab => "display",
|
||||
|
|
@ -64,7 +70,13 @@ property assetOrder => (
|
|||
fieldType => 'selectBox',
|
||||
label => ['asset order label', 'Asset_Layout'],
|
||||
hoverHelp => ['asset order hoverHelp', 'Asset_Layout'],
|
||||
noFormPost => 1,
|
||||
options => sub {
|
||||
tie my %assetOrder, "Tie::IxHash", (
|
||||
"asc" => $i18n->get("asset order asc"),
|
||||
"desc" => $i18n->get("asset order desc"),
|
||||
);
|
||||
return \%assetOrder;
|
||||
},
|
||||
);
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -94,113 +106,25 @@ These methods are available from this class:
|
|||
|
||||
Extends the base method to handle the optional mobileTemplateId and assetsToHide.
|
||||
|
||||
=cut
|
||||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $f = super();
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_Layout");
|
||||
|
||||
my ($templateId);
|
||||
if (($self->assetId eq "new") && ($self->getParent->isa('WebGUI::Asset::Wobject::Layout'))) {
|
||||
$templateId = $self->getParent->templateId;
|
||||
}
|
||||
else {
|
||||
$templateId = $self->templateId;
|
||||
$f->getTab('display')->getField('templateId')->set( value => $self->getParent->templateId );
|
||||
}
|
||||
|
||||
tie my %extraFields, "Tie::IxHash";
|
||||
%extraFields = (
|
||||
templateId => {
|
||||
fieldType => 'template',
|
||||
tab => 'display',
|
||||
value => $templateId,
|
||||
label => $i18n->get('layout template title'),
|
||||
hoverHelp => $i18n->get('template description'),
|
||||
namespace => "Layout",
|
||||
});
|
||||
|
||||
if ( $self->session->setting->get('useMobileStyle') ) {
|
||||
$extraFields{mobileTemplateId} = {
|
||||
fieldType => 'template',
|
||||
tab => 'display',
|
||||
name => 'mobileTemplateId',
|
||||
value => $self->mobileTemplateId,
|
||||
label => $i18n->get('mobileTemplateId label'),
|
||||
hoverHelp => $i18n->get('mobileTemplateId description'),
|
||||
namespace => 'Layout',
|
||||
};
|
||||
}
|
||||
else {
|
||||
$extraFields{mobileTemplateId} = {
|
||||
fieldType => 'hidden',
|
||||
tab => 'display',
|
||||
name => 'mobileTemplateId',
|
||||
value => $self->mobileTemplateId,
|
||||
};
|
||||
if ( !$self->session->setting->get('useMobileStyle') ) {
|
||||
$f->getTab('display')->deleteField( 'mobileTemplateId' );
|
||||
}
|
||||
|
||||
tie my %assetOrder, "Tie::IxHash";
|
||||
%assetOrder = (
|
||||
"asc" => $i18n->get("asset order asc"),
|
||||
"desc" => $i18n->get("asset order desc"),
|
||||
);
|
||||
$extraFields{assetOrder} = {
|
||||
tab => 'display',
|
||||
fieldType => 'selectBox',
|
||||
name => 'assetOrder',
|
||||
label => $i18n->get('asset order label'),
|
||||
hoverHelp => $i18n->get('asset order hoverHelp'),
|
||||
value => $self->assetOrder,
|
||||
options => \%assetOrder,
|
||||
};
|
||||
|
||||
if ($self->get("assetId") eq "new") {
|
||||
$extraFields{whatNext} = {
|
||||
fieldType => 'whatNext',
|
||||
value => "view",
|
||||
options => {
|
||||
view => $i18n->get(823),
|
||||
viewParent => $i18n->get(847)
|
||||
},
|
||||
};
|
||||
}
|
||||
else {
|
||||
my @assetsToHide = split("\n",$self->assetsToHide);
|
||||
my $childIter = $self->getLineageIterator(["children"],{excludeClasses=>["WebGUI::Asset::Wobject::Layout"]});
|
||||
my %childIds;
|
||||
while ( 1 ) {
|
||||
my $child;
|
||||
eval { $child = $childIter->() };
|
||||
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
|
||||
$self->session->log->error($x->full_message);
|
||||
next;
|
||||
}
|
||||
last unless $child;
|
||||
$childIds{$child->getId} = $child->getTitle;
|
||||
}
|
||||
$extraFields{assetsToHide} = {
|
||||
fieldType => 'checkList',
|
||||
tab => 'display',
|
||||
name => "assetsToHide",
|
||||
value => \@assetsToHide,
|
||||
options => \%childIds,
|
||||
label => $i18n->get('assets to hide'),
|
||||
hoverHelp => $i18n->get('assets to hide description'),
|
||||
vertical => 1,
|
||||
uiLevel => 9,
|
||||
};
|
||||
}
|
||||
|
||||
my $overrides = $self->session->config->get("assets/".$self->get("className"));
|
||||
foreach my $fieldName (keys %extraFields) {
|
||||
$self->setupFormField($tabform, $fieldName, \%extraFields, $overrides);
|
||||
}
|
||||
|
||||
return $tabform;
|
||||
return $f;
|
||||
};
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 prepareView
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ Extend the base class to handle the answers and graphing plugins.
|
|||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $fb = super();
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_Poll");
|
||||
my ($i, $answers);
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
|
|
@ -264,34 +264,35 @@ override getEditForm => sub {
|
|||
$answers .= $self->get("a".$i)."\n";
|
||||
}
|
||||
}
|
||||
$tabform->getTab("properties")->textarea(
|
||||
-name=>"answers",
|
||||
-label=>$i18n->get(7),
|
||||
-hoverHelp=>$i18n->get('7 description'),
|
||||
-subtext=>('<span class="formSubtext"><br />'.$i18n->get(8).'</span>'),
|
||||
-value=>$answers
|
||||
$fb->getTab("properties")->addField( "textarea",
|
||||
name=>"answers",
|
||||
label=>$i18n->get(7),
|
||||
hoverHelp=>$i18n->get('7 description'),
|
||||
subtext=>('<span class="formSubtext"><br />'.$i18n->get(8).'</span>'),
|
||||
value=>$answers
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-name=>"resetVotes",
|
||||
-label=>$i18n->get(10),
|
||||
-hoverHelp=>$i18n->get('10 description')
|
||||
$fb->getTab("properties")->addField( "YesNo",
|
||||
name=>"resetVotes",
|
||||
label=>$i18n->get(10),
|
||||
hoverHelp=>$i18n->get('10 description')
|
||||
) if $self->session->form->process("func") ne 'add';
|
||||
|
||||
|
||||
if (WebGUI::Image::Graph->getPluginList($self->session)) {
|
||||
my $config = $self->getGraphConfig;
|
||||
|
||||
$tabform->addTab('graph', $i18n->get('Graphing','Image_Graph'));
|
||||
$tabform->getTab('graph')->yesNo(
|
||||
-name => 'generateGraph',
|
||||
-label => $i18n->get('generate graph'),
|
||||
-hoverHelp => $i18n->get('generate graph description'),
|
||||
-value => $self->generateGraph,
|
||||
$fb->addTab('graph', $i18n->get('Graphing','Image_Graph'));
|
||||
$fb->getTab('graph')->addField( "yesNo",
|
||||
name => 'generateGraph',
|
||||
label => $i18n->get('generate graph'),
|
||||
hoverHelp => $i18n->get('generate graph description'),
|
||||
value => $self->generateGraph,
|
||||
);
|
||||
$tabform->getTab('graph')->raw(WebGUI::Image::Graph->getGraphingTab($self->session, $config));
|
||||
# TODO: Fix graphing plugins to use FormBuilder API
|
||||
$fb->getTab('graph')->raw(WebGUI::Image::Graph->getGraphingTab($self->session, $config));
|
||||
}
|
||||
|
||||
return $tabform;
|
||||
return $fb;
|
||||
};
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -51,144 +51,169 @@ property dbQuery1 => (
|
|||
default => undef,
|
||||
label => [4, 'Asset_SQLReport', 1],
|
||||
hoverHelp => ['4 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query1',
|
||||
);
|
||||
property prequeryStatements1 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => ['Prequery statements %s', 'Asset_SQLReport', 1],
|
||||
rowClass => 'query1',
|
||||
);
|
||||
property preprocessMacros1 => (
|
||||
fieldType => "yesNo",
|
||||
default => 0,
|
||||
label => ['Preprocess macros on query %s?', 'Asset_SQLReport', 1],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query1',
|
||||
);
|
||||
property placeholderParams1 => (
|
||||
fieldType => "textarea",
|
||||
default => undef,
|
||||
label => ['Placeholder Parameters %s', 'Asset_SQLReport', 1],
|
||||
hoverHelp => ['Placeholder Parameters description', 'Asset_RichEdit'],
|
||||
rowClass => 'query1',
|
||||
);
|
||||
property databaseLinkId1 => (
|
||||
fieldType => "databaseLink",
|
||||
default => 0,
|
||||
label => ['Database Link %s', 'Asset_SQLReport', 1],
|
||||
rowClass => 'query1',
|
||||
);
|
||||
property dbQuery2 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => [4, 'Asset_SQLReport', 2],
|
||||
hoverHelp => ['4 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query2',
|
||||
);
|
||||
property prequeryStatements2 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => ['Prequery statements %s', 'Asset_SQLReport', 2],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query2',
|
||||
);
|
||||
property preprocessMacros2 => (
|
||||
fieldType => "yesNo",
|
||||
default => 0,
|
||||
label => ['Preprocess macros on query %s?', 'Asset_SQLReport', 2],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query2',
|
||||
);
|
||||
property placeholderParams2 => (
|
||||
fieldType => "textarea",
|
||||
default => undef,
|
||||
label => ['Placeholder Parameters %s', 'Asset_SQLReport', 2],
|
||||
hoverHelp => ['Placeholder Parameters description', 'Asset_RichEdit'],
|
||||
rowClass => 'query2',
|
||||
);
|
||||
property databaseLinkId2 => (
|
||||
fieldType => "databaseLink",
|
||||
default => 0,
|
||||
label => ['Database Link %s', 'Asset_SQLReport', 2],
|
||||
rowClass => 'query2',
|
||||
);
|
||||
property dbQuery3 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => [4, 'Asset_SQLReport', 3],
|
||||
hoverHelp => ['4 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query3',
|
||||
);
|
||||
property prequeryStatements3 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => ['Prequery statements %s', 'Asset_SQLReport', 3],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query3',
|
||||
);
|
||||
property preprocessMacros3 => (
|
||||
fieldType => "yesNo",
|
||||
default => 0,
|
||||
label => ['Preprocess macros on query %s?', 'Asset_SQLReport', 3],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query3',
|
||||
);
|
||||
property placeholderParams3 => (
|
||||
fieldType => "textarea",
|
||||
default => undef,
|
||||
label => ['Placeholder Parameters %s', 'Asset_SQLReport', 3],
|
||||
hoverHelp => ['Placeholder Parameters description', 'Asset_RichEdit'],
|
||||
rowClass => 'query3',
|
||||
);
|
||||
property databaseLinkId3 => (
|
||||
fieldType => "databaseLink",
|
||||
default => 0,
|
||||
label => ['Database Link %s', 'Asset_SQLReport', 3],
|
||||
rowClass => 'query3',
|
||||
);
|
||||
property dbQuery4 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => [4, 'Asset_SQLReport', 4],
|
||||
hoverHelp => ['4 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query4',
|
||||
);
|
||||
property prequeryStatements4 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => ['Prequery statements %s', 'Asset_SQLReport', 4],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query4',
|
||||
);
|
||||
property preprocessMacros4 => (
|
||||
fieldType => "yesNo",
|
||||
default => 0,
|
||||
label => ['Preprocess macros on query %s?', 'Asset_SQLReport', 4],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query4',
|
||||
);
|
||||
property placeholderParams4 => (
|
||||
fieldType => "textarea",
|
||||
default => undef,
|
||||
label => ['Placeholder Parameters %s', 'Asset_SQLReport', 4],
|
||||
hoverHelp => ['Placeholder Parameters description', 'Asset_RichEdit'],
|
||||
rowClass => 'query4',
|
||||
);
|
||||
property databaseLinkId4 => (
|
||||
fieldType => "databaseLink",
|
||||
default => 0,
|
||||
label => ['Database Link %s', 'Asset_SQLReport', 4],
|
||||
rowClass => 'query4',
|
||||
);
|
||||
property dbQuery5 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => [4, 'Asset_SQLReport', 5],
|
||||
hoverHelp => ['4 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query5',
|
||||
);
|
||||
property prequeryStatements5 => (
|
||||
fieldType => "codearea",
|
||||
default => undef,
|
||||
label => ['Prequery statements %s', 'Asset_SQLReport', 5],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query5',
|
||||
);
|
||||
property preprocessMacros5 => (
|
||||
fieldType => "yesNo",
|
||||
default => 0,
|
||||
label => ['Preprocess macros on query %s?', 'Asset_SQLReport', 5],
|
||||
hoverHelp => ['15 description', 'Asset_RichEdit'],
|
||||
rowClass => 'query5',
|
||||
);
|
||||
property placeholderParams5 => (
|
||||
fieldType => "textarea",
|
||||
default => undef,
|
||||
label => ['Placeholder Parameters %s', 'Asset_SQLReport', 5],
|
||||
hoverHelp => ['Placeholder Parameters description', 'Asset_RichEdit'],
|
||||
rowClass => 'query5',
|
||||
);
|
||||
property databaseLinkId5 => (
|
||||
fieldType => "databaseLink",
|
||||
default => 0,
|
||||
label => ['Database Link %s', 'Asset_SQLReport', 5],
|
||||
rowClass => 'query5',
|
||||
);
|
||||
property debugMode => (
|
||||
fieldType => "yesNo",
|
||||
|
|
@ -289,183 +314,17 @@ Manually make the edit form due to javascript for adding more queries.
|
|||
=cut
|
||||
|
||||
override getEditForm => sub {
|
||||
my $self = shift;
|
||||
my $tabform = super();
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_SQLReport");
|
||||
$tabform->getTab("display")->template(
|
||||
-value=>$self->getValue('templateId'),
|
||||
-label=>$i18n->get(72),
|
||||
-hoverHelp=>$i18n->get('72 description'),
|
||||
-namespace=>"SQLReport"
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-name=>"debugMode",
|
||||
-label=>$i18n->get(16),
|
||||
-hoverHelp=>$i18n->get('16 description'),
|
||||
-value=>$self->getValue("debugMode")
|
||||
);
|
||||
$tabform->getTab("display")->interval(
|
||||
-name=>"cacheTimeout",
|
||||
-label=>$i18n->get('cache timeout'),
|
||||
-hoverHelp=>$i18n->get('cache timeout description'),
|
||||
-uiLevel => 8,
|
||||
-value=>$self->getValue("cacheTimeout")
|
||||
);
|
||||
|
||||
|
||||
### Download
|
||||
# Download Type
|
||||
my %downloadTypes;
|
||||
tie %downloadTypes, 'Tie::IxHash',
|
||||
"none" => $i18n->get("No Download"),
|
||||
"csv" => $i18n->get("CSV"),
|
||||
"template" => $i18n->get("Template"),
|
||||
;
|
||||
|
||||
$tabform->getTab("properties")->radioList(
|
||||
-name=>"downloadType", # ID is downloadType_formId
|
||||
-label=>$i18n->get("download type"),
|
||||
-hoverHelp=>$i18n->get("download type description"),
|
||||
-vertical=>1,
|
||||
-options=> \%downloadTypes,
|
||||
-defaultValue=>"none",
|
||||
-value=>$self->getValue("downloadType"),
|
||||
-extras=> "onclick='changeDownloadType(this)'"
|
||||
);
|
||||
|
||||
# Download Filename
|
||||
$tabform->getTab("properties")->text(
|
||||
-name=>"downloadFilename", # ID is downloadFilename_formId
|
||||
-label=>$i18n->get("download filename"),
|
||||
-hoverHelp=>$i18n->get("download filename description"),
|
||||
-value=>$self->getValue("downloadFilename"),
|
||||
);
|
||||
|
||||
# Download template (if necessary)
|
||||
$tabform->getTab("properties")->template(
|
||||
-name=>"downloadTemplateId", # ID is downloadTemplateId_formId
|
||||
-label=>$i18n->get("download template"),
|
||||
-hoverHelp=>$i18n->get("download template description"),
|
||||
-value=>$self->getValue("downloadTemplateId"),
|
||||
-namespace=>"SQLReport/Download",
|
||||
);
|
||||
|
||||
# Download mimeType (if necessary)
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my ( $style, $url ) = $session->quick( qw( style url ) );
|
||||
|
||||
$tabform->getTab("properties")->selectBox(
|
||||
-name=>"downloadMimeType",
|
||||
-label=>$i18n->get("download mimetype"),
|
||||
-hoverHelp=>$i18n->get("download mimetype description"),
|
||||
#-options=> \%downloadMimeType,
|
||||
-value=>$self->getValue("downloadMimeType"),
|
||||
-defaultValue=>"application/octet-stream",
|
||||
);
|
||||
|
||||
# Download UserGroup
|
||||
$tabform->getTab("security")->group(
|
||||
-name=>"downloadUserGroup",
|
||||
-label=>$i18n->get("download usergroup"),
|
||||
-hoverHelp=>$i18n->get("download usergroup description"),
|
||||
-value=>$self->getValue("downloadUserGroup"),
|
||||
-defaultValue=>$self->getValue("groupIdView"),
|
||||
);
|
||||
|
||||
# javascript
|
||||
$self->session->style->setScript($self->session->url->extras("wobject/SQLReport/editFormDownload.js"));
|
||||
|
||||
### /DOWNLOAD
|
||||
|
||||
|
||||
# Add toggleQuery javascript
|
||||
$tabform->getTab("properties")->raw(qq|
|
||||
<script type="text/javascript">
|
||||
function toggleQuery(Id) {
|
||||
queryClass = "query" + Id;
|
||||
var tr = document.getElementsByTagName("tr");
|
||||
if (tr == null) return undef;
|
||||
for (i=0; i < tr.length; i++) {
|
||||
if(tr[i].className == queryClass) {
|
||||
if(tr[i].style.display == 'none') {
|
||||
tr[i].style.display = '';
|
||||
} else {
|
||||
tr[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|);
|
||||
# Add javascript
|
||||
$style->setScript( $url->extras("wobject/SQLReport/editFormDownload.js"), { type => 'text/javascript', } );
|
||||
$style->setScript( $url->extras("yui/build/yahoo-dom-event/yahoo-dom-event.js"), { type => 'text/javascript' } );
|
||||
|
||||
for my $nr (1..5) {
|
||||
# Set TR class for this query properties
|
||||
$tabform->getTab("properties")->trClass("query".$nr);
|
||||
# TODO: Add query toggling back
|
||||
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-value=>"<hr>",
|
||||
-label=>join '', "<b>", $i18n->get('4'), $nr,":</b>",
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-name=>"preprocessMacros".$nr,
|
||||
-label=>$i18n->get(15),
|
||||
-hoverHelp=>$i18n->get('15 description'),
|
||||
-value=>$self->getValue("preprocessMacros".$nr)
|
||||
);
|
||||
$tabform->getTab("properties")->textarea(
|
||||
-name=>"placeholderParams".$nr,
|
||||
-label=>$i18n->get('Placeholder Parameters'),
|
||||
-hoverHelp=>$i18n->get('Placeholder Parameters description'),
|
||||
-value=>$self->getValue("placeholderParams".$nr)
|
||||
);
|
||||
$tabform->getTab("properties")->codearea(
|
||||
-name => "prequeryStatements".$nr,
|
||||
-label => $i18n->get('Prequery statements'),
|
||||
-hoverHelp => $i18n->get('Prequery statements description'),
|
||||
-syntax => "sql",
|
||||
-value => $self->getValue("prequeryStatements".$nr),
|
||||
);
|
||||
$tabform->getTab("properties")->codearea(
|
||||
-name=>"dbQuery".$nr,
|
||||
-label=>$i18n->get(4),
|
||||
-hoverHelp=>$i18n->get('4 description'),
|
||||
-syntax => "sql",
|
||||
-value=>$self->getValue("dbQuery".$nr)
|
||||
);
|
||||
$tabform->getTab("properties")->databaseLink(
|
||||
-name=>"databaseLinkId".$nr,
|
||||
-value=>$self->getValue("databaseLinkId".$nr)
|
||||
);
|
||||
|
||||
# Add a "Add another query" button
|
||||
if ($nr < 5 and ($self->get("dbQuery".($nr+1)) eq "" || ($self->get("dbQuery".($nr)) eq "" and $self->get("dbQuery".($nr+1)) ne ""))) {
|
||||
$tabform->getTab("properties")->button(
|
||||
-value=>$i18n->get('Add another query'),
|
||||
-extras=>'onclick="toggleQuery(\''.($nr+1).'\'); this.style.display=\'none\';"',
|
||||
-noWait=>1
|
||||
);
|
||||
}
|
||||
|
||||
# Make empty query blocks invisible
|
||||
if ($nr > 1 && ($self->get("dbQuery".$nr) eq "" || $self->get("dbQuery".($nr-1)) eq "")) {
|
||||
$tabform->getTab("properties")->raw(qq|
|
||||
<script type="text/javascript">
|
||||
toggleQuery('$nr');
|
||||
</script>
|
||||
|);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Undefine TR class
|
||||
$tabform->getTab("properties")->trClass();
|
||||
|
||||
$tabform->getTab("display")->integer(
|
||||
-name=>"paginateAfter",
|
||||
-label=>$i18n->get(14),
|
||||
-hoverHelp=>$i18n->get('14 description'),
|
||||
-value=>$self->getValue("paginateAfter")
|
||||
);
|
||||
|
||||
return $tabform;
|
||||
return super();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ use strict;
|
|||
|
||||
our $I18N = {
|
||||
|
||||
'buttons' => {
|
||||
message => q{Buttons},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'toolbar buttons' => {
|
||||
message => q|Toolbar Buttons|,
|
||||
lastUpdated => 1115139736,
|
||||
|
|
|
|||
|
|
@ -21,4 +21,19 @@ sub list_of_tables {
|
|||
return [qw/assetData FileAsset ImageAsset/];
|
||||
}
|
||||
|
||||
sub t_11_getEditForm : Tests( 2 ) {
|
||||
my $test = shift;
|
||||
$test->SUPER::getEditForm( @_ );
|
||||
my $session = $test->session;
|
||||
my ( $tag, $asset, @parents ) = $test->getAnchoredAsset();
|
||||
|
||||
# Test extra fields
|
||||
my $f = $asset->getEditForm;
|
||||
isa_ok( $f->getTab("properties")->getField("thumbnail"), "WebGUI::Form::ReadOnly" );
|
||||
isa_ok( $f->getTab("properties")->getField("imageSize"), "WebGUI::Form::ReadOnly" );
|
||||
|
||||
# TODO: Test overrides for extra fields
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -24,4 +24,9 @@ sub parent_list {
|
|||
return ['WebGUI::Asset::Wobject::Matrix'];
|
||||
}
|
||||
|
||||
sub t_11_getEditForm : Tests {
|
||||
ok(1); # TODO: Test MatrixListing getEditForm
|
||||
# Do not extend other test
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -24,4 +24,9 @@ sub parent_list {
|
|||
return ['WebGUI::Asset::Wobject::StoryArchive'];
|
||||
}
|
||||
|
||||
sub t_11_getEditForm : Tests {
|
||||
# Override because getEditForm returns straight HTML
|
||||
ok(1);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -24,4 +24,9 @@ sub parent_list {
|
|||
return ['WebGUI::Asset::Wobject::WikiMaster'];
|
||||
}
|
||||
|
||||
sub t_11_getEditForm : Tests {
|
||||
ok(1);
|
||||
# Override, getEditForm returns HTML
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue