~ubuntu-branches/debian/sid/libembperl-perl/sid

« back to all changes in this revision

Viewing changes to Embperl/Form/Control/number.pm

  • Committer: Package Import Robot
  • Author(s): Florian Schlichting, Jonathan Yu, Salvatore Bonaccorso, Dominic Hargreaves, Ansgar Burchardt, Florian Schlichting
  • Date: 2012-10-02 22:39:09 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20121002223909-vhrio164s2xa8qd3
Tags: 2.5.0~rc2-1
[ Jonathan Yu ]
* Imported Upstream version 2.4.0.

[ Salvatore Bonaccorso ]
* debian/copyright: Re-add Ryan and Gregor to copyright for debian/*
  packaging.

[ Dominic Hargreaves ]
* Switch to dpkg-source 3.0 (quilt) format.
* Remove obsolete perl5.10.patch, perl5.12.patch.

[ Ansgar Burchardt ]
* debian/control: Convert Vcs-* fields to Git.

[ Florian Schlichting ]
* Imported Upstream version 2.5.0~rc2 (Closes: #624578, #666011).
* Patches forwarded upstream and thus obsoleted:
  german.patch, new_process_group.patch, utf8.patch, fix-pod-errors.patch,
  fix-whatis.patch, fix-string-typo.patch, fix-pod-unescaped-unicode.patch.
* Refreshed delay.patch (fuzz).
* Dropped modperl.patch, mod_perl versions < 2 are history.
* Dropped Makefile.PL.patch, divide et impera - style:
  + FORCEMP1 is no longer relevant, Makefile.PL can find Apache headers etc
    itself
  + replacing a custom prompt implementation is unnecessary
  + strip .pl suffix in debian/rules instead of Makefile.PL
  + with hardening flags enabled, there is nothing left in the output of
    `apxs2 -q CFLAGS` that makes a difference
* Bumped Standards-Version to 3.9.4 (using copyright-format 1.0) and updated
  upstream copyright holders.
* Switched dh compatibility to level 9 to enable passing of hardening flags.
* Switched to short-form debian/rules.
* Deleted obsolete README.source.
* Removed version on mod-perl dependency (no older version in the archive).
* Moved apache2-mpm-prefork from Suggests: to Recommends:.
* Updated short and long description.
* Replaced embedded code copy (prototype.js) by a symlink and suggest:
  libjs-prototype.
* Added myself to uploaders and copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
###################################################################################
3
3
#
4
 
#   Embperl - Copyright (c) 1997-2005 Gerald Richter / ecos gmbh   www.ecos.de
 
4
#   Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh  www.ecos.de
 
5
#   Embperl - Copyright (c) 2008-2012 Gerald Richter
5
6
#
6
7
#   You may distribute under the terms of either the GNU General Public
7
8
#   License or the Artistic License, as specified in the Perl README file.
21
22
 
22
23
use Embperl::Inline ;
23
24
 
 
25
# ------------------------------------------------------------------------------------------
 
26
 
 
27
sub get_std_control_attr
 
28
    {
 
29
    my ($self, $req, $id, $type, $addclass) = @_ ;
 
30
 
 
31
    return $self -> SUPER::get_std_control_attr ($req, $id, $type, $type eq 'readonly'?'ef-control-number-readonly':$addclass) ;
 
32
    }
 
33
    
 
34
 
 
35
# ---------------------------------------------------------------------------
 
36
#
 
37
#   show_control_readonly - output the control as readonly
 
38
#
 
39
 
 
40
sub show_control_readonly 
 
41
    {
 
42
    my ($self, $req, $value) = @_ ;
 
43
 
 
44
    my $unit = $self->{unit} ;
 
45
    my $unittext = $self -> form -> convert_text ($self, ($unit =~ /:/)?$unit:"unit:$unit", $unit) ;
 
46
    $unittext =~ s/^unit:// ;
 
47
    $value = $self -> {value} || $Embperl::fdat{$self -> {name}} if (!defined($value)) ;
 
48
    $value .= $unittext if ($unit && $value ne '') ;
 
49
 
 
50
    $self -> SUPER::show_control_readonly ($req, $value) ;
 
51
    }
 
52
 
 
53
# ---------------------------------------------------------------------------
 
54
#
 
55
#   get_validate_auto_rules - get rules for validation, in case user did
 
56
#                             not specify any
 
57
#
 
58
 
 
59
sub get_validate_auto_rules
 
60
    {
 
61
    my ($self, $req) = @_ ;
 
62
    
 
63
    return [ $self -> {required}?(required => 1):(emptyok => 1), -type => 'PosInteger' ] ;
 
64
    }
 
65
 
24
66
1 ;
25
67
 
26
68
__EMBPERL__
33
75
[$ sub show_control ($self)
34
76
 
35
77
    $self->{size}      ||= 10 ;
36
 
    $self->{css_width} ||= '50%' ;
 
78
 
 
79
    my $unit = $self->{unit} ;
 
80
    my $unittext = $self -> form -> convert_text ($self, ($unit =~ /:/)?$unit:"unit:$unit", $unit) ;
 
81
    $unittext =~ s/^unit:// ;
37
82
$]
38
83
[-     $self -> SUPER::show_control ; -]
39
 
[$if ($self->{unit}) $][+ $self ->{unit} +][$endif$]
 
84
[$if ($unit) $][+ $unittext +][$endif$]
40
85
[$endsub$]
41
86
 
42
87
__END__
92
137
 
93
138
=head1 Author
94
139
 
95
 
G. Richter (richter@dev.ecos.de)
 
140
G. Richter (richter at embperl dot org)
96
141
 
97
142
=head1 See Also
98
143