- 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
|
|
@ -1,5 +1,8 @@
|
|||
7.6.2
|
||||
- fixed #8839: Documentation is wrong for Stock Ticker
|
||||
- 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.
|
||||
- Fixed a limit bug in the asset discovery service.
|
||||
|
||||
7.6.1
|
||||
|
|
|
|||
|
|
@ -818,21 +818,19 @@ sub getEditForm {
|
|||
name=>"func",
|
||||
value=>"editSave"
|
||||
});
|
||||
my $assetId;
|
||||
my $class;
|
||||
if ($self->getId eq "new") {
|
||||
$tabform->hidden({
|
||||
name=>"assetId",
|
||||
value=>"new"
|
||||
});
|
||||
$tabform->hidden({
|
||||
name=>"class",
|
||||
value=>$self->session->form->process("class","className")
|
||||
});
|
||||
$assetId = "new";
|
||||
$class = $self->session->form->process("class","className");
|
||||
}
|
||||
else {
|
||||
# revision history
|
||||
$assetId = $self->getId;
|
||||
$class = $self->get('className');
|
||||
my $ac = $self->getAdminConsole;
|
||||
$ac->addSubmenuItem($self->getUrl("func=manageRevisions"),$i18n->get("revisions").":");
|
||||
my $rs = $self->session->db->read("select revisionDate from assetData where assetId=? order by revisionDate desc limit 5", [$self->getId]);
|
||||
my $rs = $self->session->db->read("select revisionDate from assetData where assetId=? order by revisionDate desc limit 5", [$assetId]);
|
||||
while (my ($version) = $rs->array) {
|
||||
my ($interval, $units) = $self->session->datetime->secondsToInterval(time() - $version);
|
||||
$ac->addSubmenuItem($self->getUrl("func=edit;revision=".$version), $interval." ".$units." ".$ago);
|
||||
|
|
@ -875,11 +873,19 @@ sub getEditForm {
|
|||
tie my %baseProperties, 'Tie::IxHash';
|
||||
%baseProperties = (
|
||||
assetId => {
|
||||
fieldType => "readOnly",
|
||||
fieldType => "guid",
|
||||
label => $i18n->get("asset id"),
|
||||
value => $self->get("assetId"),
|
||||
value => $assetId,
|
||||
hoverHelp => $i18n->get('asset id description'),
|
||||
tab => "properties",
|
||||
uiLevel => 9,
|
||||
tab => "meta",
|
||||
},
|
||||
class => {
|
||||
fieldType => "className",
|
||||
label => $i18n->get("class name",'WebGUI'),
|
||||
value => $class,
|
||||
uiLevel => 9,
|
||||
tab => "meta",
|
||||
},
|
||||
keywords => {
|
||||
label => $i18n->get('keywords'),
|
||||
|
|
|
|||
|
|
@ -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