lib/TWiki/Form/Label.pm
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/TWiki/Form/Label.pm	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +# See bottom of file for license and copyright details
     1.5 +package TWiki::Form::Label;
     1.6 +use base 'TWiki::Form::FieldDefinition';
     1.7 +
     1.8 +use strict;
     1.9 +
    1.10 +sub isEditable {
    1.11 +    return 0;
    1.12 +}
    1.13 +
    1.14 +sub renderForEdit {
    1.15 +    my( $this, $web, $topic, $value ) = @_;
    1.16 +
    1.17 +    # Changing labels through the URL is a feature for TWiki applications,
    1.18 +    # even though it's not accessible for standard edits. Some contribs
    1.19 +    # may want to override this to make labels editable.
    1.20 +    my $session = $this->{session};
    1.21 +    my $renderedValue = $session->renderer->getRenderedVersion
    1.22 +      ( $session->handleCommonTags( $value, $web, $topic ));
    1.23 +    return ( '',
    1.24 +             CGI::hidden( -name => $this->{name},
    1.25 +                          -value => $value )
    1.26 +                 . CGI::div( { class => 'twikiEditFormLabelField' },
    1.27 +                             $renderedValue ));
    1.28 +}
    1.29 +
    1.30 +1;
    1.31 +__DATA__
    1.32 +
    1.33 +Module of TWiki Enterprise Collaboration Platform, http://TWiki.org/
    1.34 +
    1.35 +Copyright (C) 2001-2007 TWiki Contributors. All Rights Reserved.
    1.36 +TWiki Contributors are listed in the AUTHORS file in the root of
    1.37 +this distribution. NOTE: Please extend that file, not this notice.
    1.38 +
    1.39 +This program is free software; you can redistribute it and/or
    1.40 +modify it under the terms of the GNU General Public License
    1.41 +as published by the Free Software Foundation; either version 2
    1.42 +of the License, or (at your option) any later version. For
    1.43 +more details read LICENSE in the root of this distribution.
    1.44 +
    1.45 +This program is distributed in the hope that it will be useful,
    1.46 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.47 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1.48 +
    1.49 +As per the GPL, removal of this notice is prohibited.
    1.50 +