- Added Guid form control.
- Moved Asset ID and Class Name fields to the Meta tab of all assets. - Made Classname from control a subclass of ReadOnly.
This commit is contained in:
parent
2b8a3c279d
commit
84d7c20fed
5 changed files with 119 additions and 57 deletions
|
|
@ -15,7 +15,7 @@ package WebGUI::Form::ClassName;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Form::Text';
|
||||
use base 'WebGUI::Form::ReadOnly';
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -28,7 +28,7 @@ Creates a field for typing in perl class names which is validated for taint safe
|
|||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::Text.
|
||||
This is a subclass of WebGUI::Form::ReadOnly.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
|
|
@ -65,32 +65,5 @@ sub getValue {
|
|||
return $value;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isDynamicCompatible ( )
|
||||
|
||||
Returns 0.
|
||||
|
||||
=cut
|
||||
|
||||
sub isDynamicCompatible {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders a class name field.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
$self->session->style->setScript($self->session->url->extras('inputCheck.js'),{ type=>'text/javascript' });
|
||||
$self->set("extras", $self->get('extras') . ' onkeyup="doInputCheck(document.getElementById(\''.$self->get("id").'\'),\'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890:_\')" ');
|
||||
return $self->SUPER::toHtml;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
84
lib/WebGUI/Form/Guid.pm
Normal file
84
lib/WebGUI/Form/Guid.pm
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package WebGUI::Form::Guid;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Form::ReadOnly';
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Form::Guid
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Creates a form control for feeding WebGUI IDs (which are called GUIDs or Global Unique IDs) through forms.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::ReadOnly.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
The following methods are specifically available from this class. Check the superclass for additional methods.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDatabaseFieldType ( )
|
||||
|
||||
Returns "char(22) binary"
|
||||
|
||||
=cut
|
||||
|
||||
sub getDatabaseFieldType {
|
||||
return "char(22) binary";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ( session )
|
||||
|
||||
Returns the human readable name of this control.
|
||||
|
||||
=cut
|
||||
|
||||
sub getName {
|
||||
my ($self, $session) = @_;
|
||||
return 'GUID';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValue ( )
|
||||
|
||||
Returns a class name which has been taint checked.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValue {
|
||||
my $self = shift;
|
||||
my $value = $self->SUPER::getValue(@_);
|
||||
if ($value =~ m/[A-Za-z0-9\-_]{1,22}/) {
|
||||
return $value;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -52,18 +52,6 @@ sub getName {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValue ( )
|
||||
|
||||
Returns undef.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValue {
|
||||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isDynamicCompatible ( )
|
||||
|
||||
A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
|
||||
|
|
@ -71,31 +59,39 @@ A class method that returns a boolean indicating whether this control is compati
|
|||
=cut
|
||||
|
||||
sub isDynamicCompatible {
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders the value.
|
||||
Renders the value and a hidden input type if a "name" attribute was specified.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
return $self->getOriginalValue;
|
||||
my $out = $self->getOriginalValue;
|
||||
if ($self->get('name') ne '') {
|
||||
$out .= $self->toHtmlAsHidden;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtmlAsHidden ( )
|
||||
|
||||
Outputs nothing.
|
||||
Outputs nothing unless a "name" attribute was specified.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtmlAsHidden {
|
||||
my $self = shift;
|
||||
if ($self->get('name') ne '') {
|
||||
return $self->SUPER::toHtmlAsHidden;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue