Merge commit '4635b91554' into WebGUI8. Syntax clean up to 7.10.2
This commit is contained in:
commit
87326192a3
46 changed files with 956 additions and 969 deletions
|
|
@ -16,7 +16,6 @@ package WebGUI::Form::Codearea;
|
|||
|
||||
use strict;
|
||||
use base 'WebGUI::Form::Textarea';
|
||||
use HTML::Entities qw(encode_entities decode_entities);
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -90,18 +89,6 @@ sub definition {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDatabaseFieldType ( )
|
||||
|
||||
Returns "MEDIUMTEXT".
|
||||
|
||||
=cut
|
||||
|
||||
sub getDatabaseFieldType {
|
||||
return "MEDIUMTEXT";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ( session )
|
||||
|
||||
Returns the human readable name of this control.
|
||||
|
|
@ -113,101 +100,4 @@ sub getName {
|
|||
return WebGUI::International->new($session, 'WebGUI')->get('codearea');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValue ( [value] )
|
||||
|
||||
Return the value, HTML decoded
|
||||
|
||||
=cut
|
||||
|
||||
sub getValue {
|
||||
my ( $self, @args ) = @_;
|
||||
my $value = $self->SUPER::getValue( @args );
|
||||
return decode_entities( $value );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 headTags ( )
|
||||
|
||||
Set the head tags for this form plugin
|
||||
|
||||
=cut
|
||||
|
||||
sub headTags {
|
||||
my $self = shift;
|
||||
my ($style, $url) = $self->session->quick(qw(style url));
|
||||
$style->setCss($url->extras("yui/build/resize/assets/skins/sam/resize.css"));
|
||||
$style->setCss($url->extras("yui/build/assets/skins/sam/skin.css"));
|
||||
$style->setScript($url->extras("yui/build/utilities/utilities.js"));
|
||||
$style->setScript($url->extras("yui/build/container/container_core-min.js"));
|
||||
$style->setScript($url->extras("yui/build/menu/menu-min.js"));
|
||||
$style->setScript($url->extras("yui/build/button/button-min.js"));
|
||||
$style->setScript($url->extras("yui/build/resize/resize-min.js"));
|
||||
$style->setScript($url->extras("yui/build/editor/editor-min.js"));
|
||||
$style->setScript($url->extras("yui-webgui/build/code-editor/code-editor.js"));
|
||||
#$style->setCss($url->extras("yui/build/logger/assets/logger.css"));
|
||||
#$style->setCss($url->extras("yui/build/logger/assets/skins/sam/logger.css"));
|
||||
#$style->setScript($url->extras("yui/build/logger/logger.js"));
|
||||
$self->SUPER::headTags();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isDynamicCompatible ( )
|
||||
|
||||
A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
|
||||
|
||||
=cut
|
||||
|
||||
sub isDynamicCompatible {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders a code area field.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
|
||||
my $value = encode_entities( $self->fixMacros($self->fixTags($self->fixSpecialCharacters(scalar $self->getOriginalValue))) );
|
||||
my $width = $self->get('width');
|
||||
if ( $width !~ /%|px/ ) {
|
||||
$width .= 'px';
|
||||
}
|
||||
my $height = $self->get('height');
|
||||
if ( $height !~ /%|px/ ) {
|
||||
$height .= 'px';
|
||||
}
|
||||
|
||||
my $id = $self->get('id');
|
||||
my $name = $self->get('name');
|
||||
my $extras = $self->get('extras');
|
||||
my $syntax = $self->get('syntax');
|
||||
my $styleAttr = $self->get('style');
|
||||
|
||||
my $codeCss = $self->session->url->extras("yui-webgui/build/code-editor/code.css");
|
||||
my $out = <<"END_HTML";
|
||||
<textarea id="$id" name="$name" $extras rows="10" cols="60" style="font-family: monospace; $styleAttr; height: 100%; width: 100%; resize: none;">$value</textarea>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
YAHOO.util.Event.onDOMReady( function () {
|
||||
var myeditor = new YAHOO.widget.CodeEditor('${id}', { toggleButton: true, handleSubmit: true, css_url: '${codeCss}', height: '${height}', width: '${width}', status: true, resize: true });
|
||||
myeditor.render();
|
||||
|
||||
//var myLogReader = new YAHOO.widget.LogReader();
|
||||
} );
|
||||
}());
|
||||
</script>
|
||||
END_HTML
|
||||
return $out;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use base 'WebGUI::Form::Text';
|
||||
use WebGUI::Form::Hidden;
|
||||
use WebGUI::International;
|
||||
use Scalar::Util qw/blessed/;
|
||||
|
||||
my $isaEpoch = qr/^-?\d+$/;
|
||||
|
||||
|
|
@ -241,8 +242,11 @@ sub toHtml {
|
|||
$value = $self->set("value",'');
|
||||
}
|
||||
else {
|
||||
$value = eval { WebGUI::DateTime->new($session, $self->getOriginalValue)->toMysqlDate; };
|
||||
$value = WebGUI::DateTime->new($session,0)->toMysqlDate if $value eq '';
|
||||
my $originalValue = $self->getOriginalValue;
|
||||
my $dt = eval { WebGUI::DateTime->new($session, $originalValue); };
|
||||
$dt = WebGUI::DateTime->new($session,0) if ! (blessed $dt && $dt->isa('DateTime')); ##Parsing error
|
||||
$dt->set_time_zone($session->datetime->getTimeZone);
|
||||
$value = $dt->toMysqlDate;
|
||||
}
|
||||
|
||||
my $field = WebGUI::Form::Text->new($self->session,
|
||||
|
|
|
|||
|
|
@ -197,7 +197,6 @@ sub toHtml {
|
|||
$self->set("extras", $self->get('extras') . q{ onblur="fixChars(this.form['}.$self->get("name").q{'])" mce_editable="true" });
|
||||
$self->set("resizable", 0);
|
||||
return $self->SUPER::toHtml.$self->{_richEdit}->getRichEditor($self->get('id'));
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ sub headTags {
|
|||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders an input tag of type text.
|
||||
Set the head tags for this form plugin
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -163,16 +163,9 @@ Renders an input tag of type text.
|
|||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $value = $self->fixMacros($self->fixTags($self->fixSpecialCharacters(scalar $self->getOriginalValue)));
|
||||
my $width = $self->get('width') || '100%';
|
||||
if ( $width !~ /%|px/ ) {
|
||||
$width .= 'px';
|
||||
}
|
||||
my $height = $self->get('height') || '100%';
|
||||
if ( $height !~ /%|px/ ) {
|
||||
$height .= 'px';
|
||||
}
|
||||
my ($style, $url, $stow) = $self->session->quick(qw(style url stow));
|
||||
my $sizeStyle = ' width: ' . $width . '; height: ' . $height . ';';
|
||||
my $width = $self->get('width') || 400;
|
||||
my $height = $self->get('height') || 150;
|
||||
my $sizeStyle = ' width: ' . $width . 'px; height: ' . $height . 'px;';
|
||||
my $out
|
||||
= '<textarea id="' . $self->get('id') . '"'
|
||||
. ' name="' . $self->get("name") . '"'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue