
richter at apache
Dec 27, 2011, 12:34 AM
Post #1 of 1
(206 views)
Permalink
|
|
svn commit: r1224880 - in /perl/embperl/trunk/Embperl: ./ Form/ Form/Control/
|
|
Author: richter Date: Tue Dec 27 08:34:26 2011 New Revision: 1224880 URL: http://svn.apache.org/viewvc?rev=1224880&view=rev Log: Make Embperl::Form more consitent Added: perl/embperl/trunk/Embperl/Form/Control/icon.pm Modified: perl/embperl/trunk/Embperl/Form.pm perl/embperl/trunk/Embperl/Form/Control.pm perl/embperl/trunk/Embperl/Form/Control/blank.pm perl/embperl/trunk/Embperl/Form/Control/checkbox.pm perl/embperl/trunk/Embperl/Form/Control/datetime.pm perl/embperl/trunk/Embperl/Form/Control/display.pm perl/embperl/trunk/Embperl/Form/Control/displaylink.pm perl/embperl/trunk/Embperl/Form/Control/grid.pm perl/embperl/trunk/Embperl/Form/Control/info.pm perl/embperl/trunk/Embperl/Form/Control/input.pm perl/embperl/trunk/Embperl/Form/Control/mult.pm perl/embperl/trunk/Embperl/Form/Control/number.pm perl/embperl/trunk/Embperl/Form/Control/radio.pm perl/embperl/trunk/Embperl/Form/Control/select.pm perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm perl/embperl/trunk/Embperl/Form/Control/tabs.pm perl/embperl/trunk/Embperl/Form/Control/textarea.pm Modified: perl/embperl/trunk/Embperl/Form.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form.pm (original) +++ perl/embperl/trunk/Embperl/Form.pm Tue Dec 27 08:34:26 2011 @@ -890,20 +890,13 @@ onSubmit="v=doValidate; doValidate=1; re [.$ sub show_controls_begin ($self, $req, $activeid) my $parent = $self -> parent_form ; -my $class = $self -> {options}{classdiv} || ($parent -> {noframe}?'cTableDivU':'cTableDiv') ; +my $class = $self -> {options}{classdiv} || ($parent -> {noframe}?'ef-tabs-border-u':'ef-tabs-border') ; $] <div id="[+ $self->{id} +]" [$if ($activeid && $self->{id} ne $activeid) $] style="display: none" [$endif$] > -[$if (!$self -> {noframe}) $]<table class="[+ $class +]"><tr><td class="cTabTD"> [$endif$] -<table class="cBase cTable cTableInput"> -[.# -- this row is necessary for fixed table layout -- #] -<tr style="display: none"> -<td class="cLabelGroup" colspan="20"></td> -<td class="cControlGroup" colspan="30"></td> -<td class="cLabelGroup" colspan="20"></td> -<td class="cControlGroup" colspan="30"></td> -</tr> +[$if (!$self -> {noframe}) $]<table class="[+ $class +]"><tr><td class="ef-tabs-content-cell"> [$endif$] + [$endsub$] [# --------------------------------------------------------------------------- @@ -912,7 +905,7 @@ $] #] [$sub show_controls_end ($self, $req) $] -</table> +<!-- </table> --> [$ if (!$self -> {noframe}) $]</td></tr></table> [$endif$] </div> @@ -976,22 +969,20 @@ $] } my $class = $lineno == 0?'cTableRow1':'cTableRow' ; -$] - <tr class="[+ $class +]" valign="[+ $self->{valign} +]" +$]<!-- line begin + <tr class="[+ $class +]" valign="[+ $self->{valign} +]" [$if $id $] id="[+ $id +]" [$endif$] [.$if ($activeid eq '-' || ($baseid eq $baseaid && $baseidn != $baseaidn)) $] style="display: none" [$endif$] > -[.* return !($activeid eq '-' || ($baseid eq $baseaid && $baseidn != $baseaidn)) *] -[$endsub$] + -->[.* return !($activeid eq '-' || ($baseid eq $baseaid && $baseidn != $baseaidn)) +*][$endsub$] [# --------------------------------------------------------------------------- # # show_line_end - output end of line #] -[$ sub show_line_end ($req) $] - </tr> -[$endsub$] +[$ sub show_line_end ($req) $]<!-- </tr> -->[$endsub$] __END__ Modified: perl/embperl/trunk/Embperl/Form/Control.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control.pm Tue Dec 27 08:34:26 2011 @@ -115,21 +115,6 @@ sub is_hidden return ; } -# --------------------------------------------------------------------------- -# -# show - output the whole control including the label -# - -sub show - - { - my ($self, $req) = @_ ; - - $fdat{$self -> {name}} = $self -> {default} if ($fdat{$self -> {name}} eq '' && exists ($self -> {default})) ; - my $span = 0 ; - $span += $self -> show_label_cell ($req, $span); - return $self -> show_control_cell ($req, $span) ; - } # --------------------------------------------------------------------------- # @@ -264,6 +249,29 @@ sub get_value return ; } + + +# --------------------------------------------------------------------------- +# +# get_std_control_attr - return the default attributes for the control +# +# ret string with all standard attribute, already html escaped +# + +sub get_std_control_attr + { + my ($self, $id, $type, $addclass) = @_ ; + + my $name = $self -> {force_name} || $self -> {name} ; + my $ctrlid = $id || $name ; + my $class = $self -> {class} ; + my $width = $self -> {width_percent} ; + my $events = $self -> {eventattrs} ; + $type ||= $self -> {type} ; + + return qq{class="ef-control ef-control-width-$width ef-control-$type ef-control-$type-width-$width $addclass $class" name="$name" id="$ctrlid" $events} ; + } + 1 ; @@ -273,6 +281,28 @@ __EMBPERL__ [$syntax EmbperlBlocks $] + + +[.# --------------------------------------------------------------------------- +# +# show - output the whole control including the label +#] + +[.$sub show ($self, $req) + +$fdat{$self -> {name}} = $self -> {default} if ($fdat{$self -> {name}} eq '' && exists ($self -> {default})) ; +my $span = 0 ; + +$]<table class="ef-element ef-element-width-[+ $self -> {width_percent} +] ef-element-[+ $self -> {type} +]"> + <tr> + [.- + $span += $self -> show_label_cell ($req, $span); + $self -> show_control_cell ($req, $span) ; + -] + </tr> + </table>[$ + endsub $] + [# --------------------------------------------------------------------------- # # show_sub_begin - output begin of sub form @@ -327,33 +357,17 @@ $] [.$ sub show_label_cell ($self, $req) my $style = ''; -my $addclass = '' ; -my $span = 20 ; -if ($self -> {width_label}) - { - $span = int($self -> {width_percent} * $self -> {width_label} / 100) ; - } -elsif ($self -> {width} > 2 && $self -> has_auto_label_size ()) - { - $span = int(40 / $self -> {width}) if ($self -> {x_percent} != 0) ; - } - $style = 'white-space:nowrap; ' if ($self->{labelnowrap}) ; -if ($self -> {width_precent} && !$self -> {width}) - { - $style .= 'width: 20%; ' ; - } -else - { - $addclass = 'cLabelBoxWidth' . ($self->{width} || 2 ) ; - } +$addclass = 'ef-label-box-width-' . ($self->{width_percent}) ; +$addclass2 = 'ef-label-width-' . ($self->{width_percent}) ; $] - <td class="cLabelBox [+ $addclass +] [$ if $self->{labelclass} $][+ " $self->{labelclass}" +][$ endif $]" - colspan="[+ $span +]" [$ if $style $]style="[+ $style +]"[$ endif $]> + <td class="ef-label-box [+ $addclass +] [$ if $self->{labelclass} $][+ " $self->{labelclass}" +][$ endif $]" [$ if $style $]style="[+ $style +]"[$ endif $]> + <div class="ef-label [+ $addclass2 +]"> [.- $self -> show_label ($req); $self -> show_label_icon ($req) ; -] + </div> </td> [- return $span ; -] [$endsub$] @@ -363,17 +377,18 @@ $] # show_control - output the control itself #] -[$ sub show_control ($self, $req) $][+ $self->{value} +][$endsub$] +[$ sub show_control ($self, $req) $]<div [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +]>[+ $self->{value} +]</div>[$endsub$] [# --------------------------------------------------------------------------- # # show_control_readonly - output the control as readonly #] -[$ sub show_control_readonly ($self, $req, $value, $class) $] -[$if $class $]<span id="_inp_[+ $self -> {name} +]" class="[+$class+]">[$endif$] -[+ defined ($value)?$value:($self -> {value} || $fdat{$self -> {name}}) +] -[$if $class $]</span>[$endif$] +[.$ sub show_control_readonly ($self, $req, $value) + +$value = $self -> {value} || $fdat{$self -> {name}} if (!defined($value)) ; +$] +<div [.+ do { local $escmode = 0 ; $self -> get_std_control_attr('', 'readonly') } +]>[+ $value +]</div> [$endsub$] [# --------------------------------------------------------------------------- @@ -391,21 +406,11 @@ $] [.$ sub show_control_cell ($self, $req, $x) - my $span = $self->{width_percent} - $x ; - my $addclass = '' ; - my $style = '' ; my $ro = $self -> is_readonly ; - if ($self -> {width_precent} && !$self -> {width}) - { - $style = "width: " . int($self -> {width_precent} * 100 / 80) . '; ' ; - } - else - { - $addclass = 'cControlBoxWidth' . ($self->{width} || 2 ) ; - } - $addclass .= ' cControlReadonly' if ($ro) ; + my $addclass = 'ef-control-box-width-' . ($self->{width_percent} || 50 ) ; + $addclass .= ' ef-control-box-readonly' if ($ro) ; $] - <td class="cControlBox [+ $addclass +]" colspan="[+ $span +]" [$ if $style $]style="[+ $style +]"[$ endif $]> + <td class="ef-control-box [+ $addclass +]"> [.* my @ret = $ro?$self -> show_control_readonly($req):$self -> show_control ($req); $self -> show_control_addons ($req) ; Modified: perl/embperl/trunk/Embperl/Form/Control/blank.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/blank.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/blank.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/blank.pm Tue Dec 27 08:34:26 2011 @@ -32,10 +32,11 @@ __EMBPERL__ [.$ sub show ($self, $data) -my $span = ($self->{width_percent}) ; -$] -<td class="cBase cControlBox" colspan="[+ $span +]">[+ $self->{text} +]</td> -[$endsub$] +$]<table class="ef-element ef-element-width-[+ $self -> {width_percent} +]"> + <tr> + <td class="ef-label-box">[+ $self->{text} +]</td> + </tr> + </table>[$endsub$] __END__ Modified: perl/embperl/trunk/Embperl/Form/Control/checkbox.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/checkbox.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/checkbox.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/checkbox.pm Tue Dec 27 08:34:26 2011 @@ -90,9 +90,9 @@ __EMBPERL__ push @{$self -> form -> {fields2empty}}, $name ; $] -<input type="checkbox" class="cBase cControlCheckbox [+ $class +]" name="[+ $self -> {force_name} || $name +]" value="[+ $val +]" +<input type="checkbox" [.+ do { local $escmode = 0 ; $self -> {eventattrs} } +] value="[+ $val +]" [$if ($self -> {sublines} || $self -> {subobjects}) $] OnClick="[+ $nsprefix +]show_checked(document, this)" [$endif$] -[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]> +> [$endsub$] __END__ Modified: perl/embperl/trunk/Embperl/Form/Control/datetime.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/datetime.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/datetime.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/datetime.pm Tue Dec 27 08:34:26 2011 @@ -158,15 +158,15 @@ __EMBPERL__ [.$ sub show_control ($self) $self -> {size} ||= 80 / ($self -> {width} || 2) ; -my $class = $self -> {class} ||= 'cControlWidthInput' ; +my $class = $self -> {class} ||= '' ; my $nsprefix = $self -> form -> {jsnamespace} ; $] -<input type="text" class="cBase cControl [+ $class +]" name="[+ $self->{name} +]" id="[+ $self->{id} +]" +<input type="text" [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +] [$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$] [$if $self -> {maxlength} $]maxlength="[+ $self->{maxlength} +]"[$endif$] > -<script type="text/javascript"> +[#<xxscript type="text/javascript"> [+ $nsprefix +]Calendar.setup( { inputField : document.getElementById('[+ $self -> {id} +]'), // ID of the input field @@ -174,8 +174,8 @@ $] //button : "trigger" // ID of the button } ); -</script> - +</xxscript> +#] [$endsub$] Modified: perl/embperl/trunk/Embperl/Form/Control/display.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/display.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/display.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/display.pm Tue Dec 27 08:34:26 2011 @@ -38,10 +38,10 @@ my $value = exists $self->{value} ? $sel $value = [ split /\t/, $value ] if $self->{split}; $value = [ split /\n/, $value ] if $self->{splitlines}; -$]<span id="[+ $id +]" [.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>[$ if ref $value eq 'ARRAY' $][$ foreach $v (@$value) $][+ $v +]<br />[$ endforeach +$]<div [.+ do { local $escmode = 0 ; $self -> get_std_control_attr('', 'readonly') } +]>[$ if ref $value eq 'ARRAY' $][$ foreach $v (@$value) $][+ $v +]<br />[$ endforeach $][$ elsif ref $value eq 'HASH' $][$ foreach $k (keys %$value) $][+ $k +]: [+ $value->{$k} +]<br />[$ endforeach $][$ elsif ref $value $]<em>[+ ref $value +]</em>[$ - else $][+ $value +][$ endif $]</span> + else $][+ $value +][$ endif $]</div> [$ if $self->{hidden} $] <input type="hidden" name="[+ $name +]" value="[+ $value +]"> Modified: perl/embperl/trunk/Embperl/Form/Control/displaylink.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/displaylink.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/displaylink.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/displaylink.pm Tue Dec 27 08:34:26 2011 @@ -64,7 +64,7 @@ $displays = [$displays] if (!ref $displ my $dispn = 0 ; $] - +<div [.+ do { local $escmode = 0 ; $self -> get_std_control_attr('', 'readonly') } +]> [$ foreach $display (@$displays) $] [$if $opens[$dispn] $] <a href="#" onclick="[+ $opens[$dispn] +][$if $hrefs[$dispn] $]('[+ $hrefs[$dispn] +]')[$endif$]" [.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]> @@ -75,7 +75,7 @@ $] [$endif$][+ $showoptions?$display:$form -> convert_text ($self, $display) +]</a> [- $dispn++ -] [$endforeach$] - +</div> __END__ =pod Modified: perl/embperl/trunk/Embperl/Form/Control/grid.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/grid.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/grid.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/grid.pm Tue Dec 27 08:34:26 2011 @@ -252,8 +252,9 @@ __EMBPERL__ $jsname .= 'Grid' ; my $max = $fdat{"__${name}_max"} ; my $on_grid_change = $self -> {on_grid_change} ; -$] - <td class="cBase cLabelBox" colspan="[+ $span +]"> +$]<table class="ef-element ef-element-width-[+ $self -> {width_percent} +]"> + <tr> + <td class="ui-label-box" colspan="[+ $span +]"> [.- $fdat{$name} = $self -> {default} if ($fdat{$name} eq '' && exists ($self -> {default})) ; my $span = 0 ; @@ -276,6 +277,8 @@ $] $('#[+ $self -> {id} +]').eplgrid ([$if $on_grid_change $]{'onchange': [+ $on_grid_change +] }[$endif$]) ; </script> </td> + </tr> + </table> [$endsub$] @@ -291,10 +294,19 @@ $] <td class="cBase cGridLabelBox">[+ $self -> form -> convert_label ($self) +]</td> [$if !($self -> {readonly}) $] <td class="cBase cGridControlBox"> + [# <img src="[+ $self -> {imagedir} +]/btn_up.gif" id="[+ $self -> {id} +]-up" title="Zeile Hoch"> <img src="[+ $self -> {imagedir} +]/btn_down.gif" id="[+ $self -> {id} +]-down" title="Zeile runter"> <img src="[+ $self -> {imagedir} +]/btn_add.gif" id="[+ $self -> {id} +]-add" title="Zeile Hinzufügen Alt-NUM+" > <img src="[+ $self -> {imagedir} +]/btn_del.gif" id="[+ $self -> {id} +]-del" title="Markierte Zeile Löschen Alt-NUM-" > + #] + <div> + <span class="ui-icon ui-icon-circle-triangle-n ef-icon" id="[+ $self -> {id} +]-up" title="Zeile Hoch"></span> + <span class="ui-icon ui-icon-circle-triangle-s ef-icon" id="[+ $self -> {id} +]-down" title="Zeile Runter"></span> + <span class="ui-icon ui-icon-circle-plus ef-icon" id="[+ $self -> {id} +]-add" title="Zeile Hinzufügen"></span> + <span class="ui-icon ui-icon-circle-minus ef-icon" id="[+ $self -> {id} +]-del" title="Markierte Zeile Löschen"></span> + </div> + </td> [$endif$] </tr> Added: perl/embperl/trunk/Embperl/Form/Control/icon.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/icon.pm?rev=1224880&view=auto ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/icon.pm (added) +++ perl/embperl/trunk/Embperl/Form/Control/icon.pm Tue Dec 27 08:34:26 2011 @@ -0,0 +1,98 @@ + +################################################################################### +# +# Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh www.ecos.de +# +# You may distribute under the terms of either the GNU General Public +# License or the Artistic License, as specified in the Perl README file. +# +# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# $Id$ +# +################################################################################### + +package Embperl::Form::Control::icon ; + +use strict ; +use base 'Embperl::Form::Control' ; + +use Embperl::Inline ; + +1 ; + +__EMBPERL__ + +[# --------------------------------------------------------------------------- +# +# show - output the control +#] + +[.$ sub show ($self, $data) + +my $span = ($self->{width_percent}); +my $section = $self->{section}; +my $class = $self -> {class} ; +$]<table class="ef-element ef-element-width-[+ $self -> {width_percent} +] ef-element-[+ $self -> {type} +]"> + <tr> + <td class="ef-control-box"> + <div [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +]> + <span class="ui-icon ui-icon-[+ $self -> {icon} +] ef-icon" title="[+ $self -> {showtext}?($self->{text}):$self -> form -> convert_text ($self) +]"></span> + </div> + </td> + </tr> + </table>[$endsub$] + + +__END__ + +=pod + +=head1 NAME + +Embperl::Form::Control::icon - Show an jQuery UI icon inside an Embperl Form + + +=head1 SYNOPSIS + + { + type => 'icon', + text => 'tool tip', + icon => 'circle-triangle-n' + } + +=head1 DESCRIPTION + +Used to create an jQuery UI icon with optional tool tip text inside an Embperl Form. +See Embperl::Form on how to specify parameters. + +=head2 PARAMETER + +=head3 type + +Needs to be 'icon' + +=head3 text (optional) + +Could be used to give a text that should be displayed when the mouse +hovers over + +=head3 icon + +Name of the icon. See http://http://jqueryui.com/themeroller + +=head3 class + +css class + +=head1 Author + +G. Richter (richter [at] dev) + +=head1 See Also + +perl(1), Embperl, Embperl::Form + + Modified: perl/embperl/trunk/Embperl/Form/Control/info.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/info.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/info.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/info.pm Tue Dec 27 08:34:26 2011 @@ -35,9 +35,11 @@ __EMBPERL__ my $span = ($self->{width_percent}); my $section = $self->{section}; my $class = $self -> {class} ; -$] -<td class="cBase cInfoBox [+ $class +]" colspan="[+ $span +]" [.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>[$ if $section $]<b>[$ endif $][$ if $self -> {image} $]<img class="cControlButtonSymbol" src="[+ $self -> {image} +]">[$endif$][+ $self -> {showtext}?($self->{text}):$self -> form -> convert_text ($self) +] [$ if $section $]</b>[$ endif $]</td> -[$endsub$] +$]<table class="ef-element ef-element-width-[+ $self -> {width_percent} +]"> + <tr> +<td class="do { local $escmode = 0 ; $self -> get_std_control_attr('', 'readonly') }">[$ if $section $]<b>[$ endif $][$ if $self -> {image} $]<img class="cControlButtonSymbol" src="[+ $self -> {image} +]">[$endif$][+ $self -> {showtext}?($self->{text}):$self -> form -> convert_text ($self) +] [$ if $section $]</b>[$ endif $]</td> +</tr> + </table>[$endsub$] __END__ Modified: perl/embperl/trunk/Embperl/Form/Control/input.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/input.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/input.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/input.pm Tue Dec 27 08:34:26 2011 @@ -32,14 +32,14 @@ __EMBPERL__ [.$ sub show_control ($self) -$self -> {size} ||= 80 / ($self -> {width} || 2) ; -$class = $self -> {class} ||= 'cControlWidthInput' ; +#$self -> {size} ||= 80 / ($self -> {width} || 2) ; +my $class = $self -> {class} ; $] -<input type="text" class="cBase cControl [+ $class +]" name="[+ $self->{name} +]" id="[+ $self->{name} +]" +<input type="text" [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +] [$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$] [$if $self -> {maxlength} $]maxlength="[+ $self->{maxlength} +]"[$endif$] -[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]> +> [$endsub$] __END__ Modified: perl/embperl/trunk/Embperl/Form/Control/mult.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/mult.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/mult.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/mult.pm Tue Dec 27 08:34:26 2011 @@ -54,8 +54,10 @@ sub init my $form = $self -> form ; $self -> {fields} ||= [$self -> {field}] ; - $self -> {class} ||= 'cMult' ; - $form -> new_controls ($self -> {fields}, $form -> {options}) ; + $self -> {class} ||= 'ef-control-mult' ; + my $options = $form -> {options} ; + my $validate_rules = $self -> {validate_rules} = [] ; + $form -> new_controls ($self -> {fields}, $options, undef, undef, $validate_rules, $options -> {masks}, $options -> {defaults}, 1) ; return $self ; } @@ -147,8 +149,9 @@ $] $fdat{$name} = $self -> {default} if ($fdat{$name} eq '' && exists ($self -> {default})) ; my $span = 0 ; -] + <div [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +]> <input type="hidden" name="__[+ $self -> {name} +]_max" id="__[+ $self -> {id} +]_max"> - <table class="[+ $self -> {class} +]Table cBase" id="[+ $self -> {id} +]"> + <table class="ef-control-mult-table" id="[+ $self -> {id} +]"> [- $self -> show_grid_table ($req) ; -] </table> <table id="__[+ $self -> {id} +]_newrow" style="display: none"> @@ -157,7 +160,7 @@ $] $self -> show_grid_table_row ($req, '%row%') ; -] </table> - + </div> [$if (! $self -> is_readonly ()) $] <[$if $noscript $]x-[$endif$]script> @@ -213,8 +216,14 @@ $] $] [$if (! $self -> is_readonly ()) $] - <img src="[+ $self -> {imagedir} +]/btn_pluss.gif" id="[+ $self -> {id} +]-add" title="Zeile Hinzufügen"> + [# + <img src="[+ $self -> {imagedir} +]/btn_plus.gif" id="[+ $self -> {id} +]-add" title="Zeile Hinzufügen"> <img src="[+ $self -> {imagedir} +]/btn_minus.gif" id="[+ $self -> {id} +]-del" title="Zeile Löschen"> + #] + + <span class="ui-icon ui-icon-circle-plus ef-icon" id="[+ $self -> {id} +]-add" title="Zeile Hinzufügen"></span> + <span class="ui-icon ui-icon-circle-minus ef-icon" id="[+ $self -> {id} +]-del" title="Zeile Löschen"></span> + [$endif$] [$endsub$] Modified: perl/embperl/trunk/Embperl/Form/Control/number.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/number.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/number.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/number.pm Tue Dec 27 08:34:26 2011 @@ -33,12 +33,13 @@ __EMBPERL__ [.$ sub show_control ($self) $self->{size} ||= 10 ; - $self->{class} ||= 'cControlWidthNumber' ; my $unit = $self->{unit} ; + my $unittext = $self -> form -> convert_text ($self, ($unit =~ /:/)?$unit:"unit:$unit", $unit) ; + $unittext =~ s/^unit:// ; $] [- $self -> SUPER::show_control ; -] -[$if ($unit) $][.+ $self -> form -> convert_text ($self, ($unit =~ /:/)?$unit:"unit:$unit", $unit) +][$endif$] +[$if ($unit) $][+ $unittext +][$endif$] [$endsub$] __END__ Modified: perl/embperl/trunk/Embperl/Form/Control/radio.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/radio.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/radio.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/radio.pm Tue Dec 27 08:34:26 2011 @@ -68,7 +68,7 @@ else } $] -<table class="cRadioTab[+ $self -> is_readonly?' cControlReadonly':''+]">[+ do { local $escmode = 0 ; $trglob }+] +<table [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +]>[+ do { local $escmode = 0 ; $trglob }+] [$ foreach $val (@$values) $][- $x = ($val =~ /$filter/i) -] [.- $fdat{$name} = $val, $set = 0 if ($set) ; $fdat{$name} = $val if ($ignorecase && lc($fdat{$name}) eq lc($val)) ; -] Modified: perl/embperl/trunk/Embperl/Form/Control/select.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/select.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/select.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/select.pm Tue Dec 27 08:34:26 2011 @@ -22,94 +22,6 @@ use base 'Embperl::Form::ControlMultValu use Embperl::Inline ; -# --------------------------------------------------------------------------- -# -# get_select_values - return values of control -# - -sub get_select_values - { - my ($self, $req) = @_ ; - - my ($values, $options) = $self -> get_values ($req) ; - my $addtop = $self -> {addtop} || [] ; - my $addbottom= $self -> {addbottom} || [] ; - my $addtop_options = [] ; - my $addbottom_options = [] ; - if (!$self -> {showoptions}) - { - $addtop_options = $self -> form -> convert_options ($self, $addtop) if ($self -> {addtop}) ; - $addbottom_options = $self -> form -> convert_options ($self, $addbottom) if ($self -> {addbottom}) ; - } - - return ($values, $options, $addtop, $addtop_options, $addbottom, $addbottom_options) ; - } - - -# --------------------------------------------------------------------------- -# -# show_control_readonly - output readonly control -# - -sub xshow_control_readonly - { - my ($self, $req) = @_ ; - - my $name = $self -> {name} ; - - my ($values, $options, $addtop, $addtop_options, $addbottom, $addbottom_options) = $self -> get_select_values ($req) ; - - my $val = $fdat{$name} ; - my $opt ; - my $i = 0 ; - foreach (@$addtop) - { - if ($_ eq $val) - { - $opt = $addtop_options -> [$i] || $val ; - last ; - } - $i++ ; - } - - if (!$opt) - { - $i = 0 ; - foreach (@$values) - { - if ($_ eq $val) - { - $opt = $options -> [$i] || $val ; - last ; - } - $i++ ; - } - } - - if (!$opt) - { - $i = 0 ; - foreach (@$addbottom) - { - if ($_ eq $val) - { - $opt = $addbottom_options -> [$i] || $val ; - last ; - } - $i++ ; - } - } - - if (!$opt) - { - $opt = $self -> form -> convert_text ($self, 'err:select_not_found') ; - } - - $self -> {value} = $opt ; - $self -> show_hidden ($req) ; - $self -> SUPER::show_control_readonly ($req) ; - } - 1 ; @@ -137,21 +49,13 @@ __EMBPERL__ my $nsprefix = $self -> form -> {jsnamespace} ; my $val ; my $i = 0 ; - my ($values, $options, $addtop, $addtop_options, $addbottom, $addbottom_options) = $self -> get_select_values ($req) ; + my ($values, $options) = $self -> get_all_values ($req) ; $] -<select [+ $self->{multiple}?'multiple':''+] class="cBase cControl cControlWidthSelect" name="[+ $name +]" id="[+ $name +]" - +<select [+ $self->{multiple}?'multiple':''+] [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +] [$if ($self -> {sublines} || $self -> {subobjects}) $] OnChange="[+ $nsprefix +]show_selected(document, this)" [$endif$] [$if ($self -> {rows}) $] size="[+ $self->{rows} +]" [$endif$] -[.+ do { local $escmode = 0 ; $self -> {eventattrs} } +]> -[* $i = 0 ; *] -[$ foreach $val (@$addtop) $] - [$if !defined ($filter) || ($val->[0] =~ /$filter/i) $] - <option value="[+ $val->[0] +]">[+ $addtop_options -> [$i] || $val ->[1] || $val -> [0] +]</option> - [$endif$] - [* $i++ ; *] -[$endforeach$] +> [* $i = 0 ; *] [$ foreach $val (@$values) $] [$if !defined ($filter) || ($val =~ /$filter/i) $] @@ -159,13 +63,6 @@ $] [$endif$] [* $i++ ; *] [$endforeach$] -[* $i = 0 ; *] -[$ foreach $val (@$addbottom) $] - [$if !defined ($filter) || ($val->[0] =~ /$filter/i) $] - <option value="[+ $val->[0] +]">[+ $addbottom_options -> [$i] || $val ->[1] || $val -> [0] +]</option> - [$endif$] - [* $i++ ; *] -[$endforeach$] </select> [$endsub$] Modified: perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm Tue Dec 27 08:34:26 2011 @@ -118,35 +118,25 @@ control_link_setup($( "#_inp_[.+ $self -> my $fdatval = $fdat{$name} ; if ($fdatval ne '') { + if (exists $fdat{"-init-$name"}) { $initval = $fdat{"-init-$name"} ; } else { - my ($values, $options) = $self -> get_values ($req) ; - my $i = 0 ; - foreach (@$values) - { - if ($_ eq $fdatval) - { - $initval = $options->[$i] ; - last ; - } - $i++ ; - } - $initval = $fdatval if (!defined ($initval)) ; + $initval = $self -> get_option_from_value ($fdatval, $req) ; } } $target = '' ; $target = "parent.frames.$self->{link_target}." if ($self -> {link_target}) ; $self -> {showurl} ||= 'ldapTreeData.epl?-id=' ; $self -> {datasrcurl} ||= '/epfctrl/datasrc.exml' ; - + my $class = $self -> {class} ; $] <div class="ui-widget"> [# --- input --- #] -<input class="cBase cControl cAutoCompInput cControlWidthSelectDyn" id="_inp_[+ $jsname +]" type="text" +<input [.+ do { local $escmode = 0 ; $self -> get_std_control_attr("_inp_$jsname") } +] type="text" [$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$] value="[+ $initval +]" > Modified: perl/embperl/trunk/Embperl/Form/Control/tabs.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/tabs.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/tabs.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/tabs.pm Tue Dec 27 08:34:26 2011 @@ -117,9 +117,9 @@ __EMBPERL__ my $line = 0 ; $] -<td class="cBase cTabTD" colspan="[+ $span +]"> +<td class="ef-tabs-content-cell" colspan="[+ $span +]"> [$ while ($more) $] - <table class="cBase cTabTable" ><tr class="cBase cTabRow"> + <table class="ef-tabs-selector" ><tr class="ef-tabs-selector-row"> [.* $more = 0 ; my $tabs = $tabs_per_line -> [$line++] ; @@ -128,8 +128,8 @@ $] [* $val = $values -> [$i] ; my $id = $self -> {subids}[$i] ; - my $cellclass = $id eq $activeid?'cTabCellOn':'cTabCellOff' ; - my $divclass = $id eq $activeid?'cTabDivOn':'cTabDivOff' ; + my $cellclass = $id eq $activeid?'ef-tabs-cell-on':'ef-tabs-cell-off' ; + my $divclass = $id eq $activeid?'ef-tabs-div-on':'ef-tabs-div-off' ; my $form = $self -> form ; my @switch_code ; @@ -141,7 +141,7 @@ $] } my $js = join (';', @switch_code) ; *] - <td class="cBase [+ $cellclass +]"><div class="cBase [+ $divclass +]" + <td class="[+ $cellclass +]"><div class="[+ $divclass +]" [$ if $i - $start_i == 0 $]style="border-left: black 1px solid" [$endif$] id="__tabs_[+ $id +]"> <a href="#" onClick="[+ $nsprefix +]tab_selected(document, '[+ $id +]','[+ $name +]'); [.+ do { local $escmode = 0 ; $js } +]" style="color:black; text-decoration: none;">[+ $options ->[$i] || $val +]</a></div></td> @@ -154,7 +154,7 @@ $] } *] [$endwhile $] - [$if ($i == @$values) $]<td class="cBase cTabCellBlank"> </td>[$endif$] + [$if ($i == @$values) $]<td class="ef-tabs-cell-blank"> </td>[$endif$] </tr></table> [$endwhile$] <input type="hidden" name="[+ $name +]" id="[+ $name +]" value="[+ $activeid +]"> Modified: perl/embperl/trunk/Embperl/Form/Control/textarea.pm URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/textarea.pm?rev=1224880&r1=1224879&r2=1224880&view=diff ============================================================================== --- perl/embperl/trunk/Embperl/Form/Control/textarea.pm (original) +++ perl/embperl/trunk/Embperl/Form/Control/textarea.pm Tue Dec 27 08:34:26 2011 @@ -30,12 +30,13 @@ __EMBPERL__ # show_control - output the control #] -[$ sub show_control ($self) $] +[.$ sub show_control ($self) +my $class = $self -> {class} ||= '' ; +$] -<textarea type="text" class="cBase cControl" name="[+ $self->{name} +]" -[$if $self -> {cols} $]cols="[+ $self->{cols} +]"[$endif$] +<textarea type="text" [.+ do { local $escmode = 0 ; $self -> get_std_control_attr() } +] +[# [$if $self -> {cols} $]cols="[+ $self->{cols} +]"[$endif$] #] [$if $self -> {rows} $]rows="[+ $self->{rows} +]"[$endif$] -[$if $self -> {id} $]id="[+ $self->{id} +]"[$endif$] ></textarea> [$endsub$] --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-cvs-unsubscribe [at] perl For additional commands, e-mail: embperl-cvs-help [at] perl
|