From embperlqroberts@example.com Sun Feb 27 17:30:07 2011
Return-Path: <embperlqroberts@example.com>
Delivered-To: qroberts@example.com
Received: (qmail 64394 invoked from network); 27 Feb 2011 17:30:06 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 27 Feb 2011 17:30:06 -0000
Received: (qmail 49384 invoked by uid 500); 27 Feb 2011 17:30:05 -0000
Delivered-To: qroberts@example.com
Received: (qmail 49002 invoked by uid 500); 27 Feb 2011 17:30:05 -0000
Mailing-List: contact qroberts@example.com; run by ezmlm
Precedence: bulk
list-help: <mailto:qroberts@example.com>
list-unsubscribe: <mailto:qroberts@example.com>
List-Post: <mailto:qroberts@example.com>
List-Id: <embperl-cvs.perl.apache.org>
Delivered-To: mailing list qroberts@example.com
Received: (qmail 48185 invoked by uid 99); 27 Feb 2011 17:30:04 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Feb 2011 17:30:04 +0000
X-ASF-Spam-Status: No, hits=-2000.0 required=5.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Feb 2011 17:30:01 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id A5C6D23889D7; Sun, 27 Feb 2011 17:29:41 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: svn commit: r1075092 - in /perl/embperl/trunk/Embperl: ./ Form/ Form/Control/
Date: Sun, 27 Feb 2011 17:29:41 -0000
To: qroberts@example.com
From: qroberts@example.com
X-Mailer: svnmailer-1.0.8
Message-Id: <qroberts@example.com>

Author: richter
Date: Sun Feb 27 17:29:40 2011
New Revision: 1075092

URL: http://svn.apache.org/viewvc?rev=1075092&view=rev
Log:
Anfang Umstellung Embperl888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4orm von prototype.js auf jQuery

Added:
    perl/embperl/trunk/Embperl/Form/Control/cell.pm   (with props)
Modified:
    perl/embperl/trunk/Embperl/Form.pm
    perl/embperl/trunk/Embperl/Form/Control.pm
    perl/embperl/trunk/Embperl/Form/Control/addremove.pm
    perl/embperl/trunk/Embperl/Form/Control/displaylink.pm
    perl/embperl/trunk/Embperl/Form/Control/duration.pm
    perl/embperl/trunk/Embperl/Form/Control/grid.pm
    perl/embperl/trunk/Embperl/Form/Control/mult.pm
    perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm
    perl/embperl/trunk/Embperl/Form/Control/table.pm

Modified: perl/embperl/trunk/Embperl/Form.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form.pm (original)
+++ perl/embperl/trunk/Embperl/Form.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -39,11 +39,11 @@ use vars qw{$epreq} ;
 
 # ---------------------------------------------------------------------------
 #
-#   new - create a new form
+#   sub_new - create a new sub form
 #
 
 
-sub new
+sub sub_new
 
     {
     my ($class, $controls, $options, $id, $validate_rules, $parentptr) = @_ ;
@@ -102,6 +102,17 @@ sub new
 
     return $self ;
     }
+
+# ---------------------------------------------------------------------------
+#
+#   new - create a new form
+#
+
+sub new
+    {
+    my $class = shift ;
+    return $class -> sub_new (@_) ;
+    }
 
 # ---------------------------------------------------------------------------
 #
@@ -169,8 +180,19 @@ sub new_object
         {
         if (!defined (&{"$name\:\:new"}))
             {
+            {
+            local $SIG{__DIE__} ;
             eval "require $name" ;
-            warn $@ if ($@ && ($@ !~ /Can\'t locate/)) ;
+            }
+            if ($@)
+                {
+                my $modfile = $name . '.pm' ;
+                $modfile =~ s/888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4/\//g ;
+                if ($@ !~ /Can\'t locate $modfile/)
+                    {
+                    die "require $name: $@" ;
+                    }
+                }
             }
         $obj = $name -> new ($args) ;
         $ctlmod = $name ;
@@ -192,8 +214,19 @@ sub new_object
             foreach my $package (@$packages)
                 {
                 my $mod = "$package\:\:$name"  ;
+                {
+                local $SIG{__DIE__} ;
                 eval "require $mod" ;
-                warn $@ if ($@ && ($@ !~ /Can\'t locate/)) ;
+                }
+                if ($@)
+                    {
+                    my $modfile = $mod . '.pm' ;
+                    $modfile =~ s/888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4/\//g ;
+                    if ($@ !~ /Can\'t locate $modfile/)
+                        {
+                        die "require $mod: $@" ;
+                        }
+                    }
                 if ($mod -> can('new'))
                     {
                     $obj = $mod -> new ($args) ;
@@ -238,6 +271,7 @@ sub new_controls
         my $type    = $control -> {type} ;
         my $default = $defaults -> {$name} || $defaults -> {"*$type"} || $defaults -> {'*'};
         my $mask    = $masks    -> {$name} || $masks -> {"*$type"} || $masks -> {'*'};
+
         if ($mask)
             {
             foreach (keys %$mask)
@@ -253,7 +287,6 @@ sub new_controls
                 }
             }
 
-
         if (ref $control eq 'HASH')
             {
             my $type = $control -> {type} || ($control -> {name}?'input':'blank') ;
@@ -287,7 +320,7 @@ sub new_controls
                 next if (!$subcontrols) ;
                 my $id = "$control->{name}-$i" ;
                 my $class = ref $self ;
-                my $subform = $class -> new ($subcontrols, $options, $id, $validate_rules, "$self") ;
+                my $subform = $class -> sub_new ($subcontrols, $options, $id, $validate_rules, "$self") ;
                 push @ids, $id ;
                 push @obj, $subform ;
                 $i++ ;
@@ -454,7 +487,7 @@ sub show_controls
         my $visible = $self -> show_line_begin ($req, $lineno, "$lineid-$n{$lineid}", $activesubid[$linelevel-1] || $activeid);
         foreach my $control (@$line)
             {
-            my $newactivesubid = $visible?$control -> get_active_id ($req):'-' ;
+            my $newactivesubid = $control -> {subobjects} && $visible?$control -> get_active_id ($req):'-' ;
             $control -> show ($req);
             $activesubid[$control -> {level}] = $newactivesubid if ($newactivesubid) ;
             if ($control -> {subobjects})

Modified: perl/embperl/trunk/Embperl/Form/Control.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -59,6 +59,7 @@ sub init
 	    }
 	}
     $self -> {eventattrs} = $eventattrs ;
+    $self -> {imagedir} ||= '/images' ;
 
     return $self ;
     }
@@ -275,7 +276,11 @@ $]
 my $style = '';
 my $addclass = '' ;
 my $span = 20 ;
-if ($self -> {width} > 2 && $self -> has_auto_label_size ())
+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) ;
     }
@@ -512,6 +517,12 @@ C<width>
 
 Default value of the control
 
+=head2 imagedir
+
+Basepath where to find images, in case the control uses images.
+Default value is /images
+
+
 =head1 AUTHOR
 
 G. Richter (qroberts@example.com)

Modified: perl/embperl/trunk/Embperl/Form/Control/addremove.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/addremove.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/addremove.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/addremove.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -62,8 +62,8 @@ $]
 
 <td class="cBase cControlBox cControlAddRemoveBox" colspan="[+ $span +]">
 <input type="hidden" id="[+ $name +]" name="[+ $name +]">
-<img src="/images/toleft.gif" title="Hinzufügen" onClick="[+ $nsprefix +]addremoveAddOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">
-<img src="/images/toright.gif" title="Entfernen" onClick="[+ $nsprefix +]addremoveRemoveOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">
+<img src="[+ $self -> {imagedir} +]/toleft.gif" title="Hinzufügen" onClick="[+ $nsprefix +]addremoveAddOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">
+<img src="[+ $self -> {imagedir} +]/toright.gif" title="Entfernen" onClick="[+ $nsprefix +]addremoveRemoveOption (document, document.getElementById('[+ $self->{src} +]'), document.getElementById('[+ $self->{dest} +]'), document.getElementById('[+ $name +]'), [+ $self->{removesource} +])">
 
 [#
     print "<input class="cStandardButton" type=button value="Hinzufügen" onClick="[+ $nsprefix +]addremoveAddOption (document, this.form.elements['$self->{src}'], this.form.elements['$self->{dest}'], this.form.elements['$self->{name}'], $self->{removesource})">\n" ;

Added: perl/embperl/trunk/Embperl/Form/Control/cell.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/cell.pm?rev=1075092&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/cell.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/cell.pm Sun Feb 27 17:29:40 2011
@@ -0,0 +1,84 @@
+
+###################################################################################
+#
+#   Embperl - Copyright (c) 1997-2005 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 Embperl888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4orm888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4ontrol888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4ll ;
+
+use strict ;
+use base 'Embperl888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4orm888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4ontrol' ;
+
+use Embperl888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4Inline ;
+
+1 ;
+
+__EMBPERL__
+    
+[# ---------------------------------------------------------------------------
+#
+#   show - output the control
+#]
+
+[$ sub show ($self, $data)
+
+my $span = ($self->{width_percent})  ;
+$]
+<td class="cBase cControlBox [+$self->{controlclass}+]" colspan="[+ $span +]"><span class="[+$self->{controlclass}+]">[+ $self->{text} +]</span></td>
+[$endsub$]
+
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4orm888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4ontrol888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4ll - A area inside an Embperl Form
+
+
+=head1 SYNOPSIS
+
+  { 
+  type => 'cell',
+  text => 'blabla' 
+  }
+
+=head1 DESCRIPTION
+
+Used to create a cell area with optional text inside an Embperl Form.
+See Embperl888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4orm on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be 'cell'
+
+=head3 text (optional)
+
+Could be used to give a text that should be displayed inside the blank area
+
+=head3 controlclass
+
+CSS class for display of text
+
+=head1 Author
+
+G. Richter (qroberts@example.com)
+
+=head1 See Also
+
+perl(1), Embperl, Embperl888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4orm
+
+

Propchange: perl/embperl/trunk/Embperl/Form/Control/cell.pm
------------------------------------------------------------------------------
    svn:executable = *

Modified: perl/embperl/trunk/Embperl/Form/Control/displaylink.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/displaylink.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/displaylink.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/displaylink.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -57,14 +57,17 @@ $targets   = [$targets] if ($targets && 
 $opens     = [$opens] if ($opens && !ref $opens) ;
 $displays  = [$displays] if (!ref $displays) ;
 
+@hrefs = map { my $x = $_ ; $x =~ s/%%(.+?)%%/$fdat{$1}/g ; $x } ref ($hrefs)?@$hrefs:($hrefs) ;
+@opens = map { my $x = $_ ; $x =~ s/%%(.+?)%%/$fdat{$1}/g ; $x } ref ($opens)?@$opens:($opens) ;
+
 my $dispn = 0 ;
 $]
 
 [$ foreach $display (@$displays) $]
-    [$if $opens -> [$dispn] $]
-        <a href="#" onclick="[+ $opens -> [$dispn] +][$if $hrefs -> [$dispn] $]('[+ $hrefs -> [$dispn] +]')[$endif$]">
+    [$if $opens[$dispn] $]
+        <a href="#" onclick="[+ $opens[$dispn] +][$if $hrefs[$dispn] $]('[+ $hrefs[$dispn] +]')[$endif$]">
     [$else$]
-        <a href="[+ do {local $escmode=0;$hrefs -> [$dispn]} +]"
+        <a href="[+ do {local $escmode=0;$hrefs[$dispn]} +]"
 	    [$if $targets -> [$dispn] $]target="[+ $targets -> [$dispn] +]"[$endif$]>
     [$endif$][+ $showoptions?$display:$form -> convert_text ($self, $display) +]</a>&nbsp;
     [- $dispn++ -]
@@ -111,12 +114,16 @@ Arrayref with texts for the links that s
 
 Arrayref with hrefs
 
+%%<name>%% is replaced by $fdat{<name>} 
+
 =head3 open
 
 Arrayref, if a value is given for the link, the value will be used as
 javascript function which is executed onclick. href will be pass as
 argument.
 
+%%<name>%% is replaced by $fdat{<name>} 
+
 =head3 target
 
 Arrayref with targets

Modified: perl/embperl/trunk/Embperl/Form/Control/duration.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/duration.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/duration.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/duration.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -32,7 +32,7 @@ sub init
 
     {
     my ($self) = @_ ;
-print STDERR "durx1\n" ;
+
     $self->{unit}      ||= '' ;
     
     return $self ;
@@ -47,23 +47,21 @@ sub init_data
     {
     my ($self, $req, $parentctrl) = @_ ;
     
-print STDERR "durx2\n" ;
     my $name    = $self->{name} ;
     my $val     = $fdat{$name} ;
     return if ($val eq '') ;
 
-    my $sec = $val % 60 ;
-    my $min = (int ($val / 60) % 60) ;
-    my $hour = int($val / 3600) ;
+    my $aval = abs ($val) ;
+    my $sec = $aval % 60 ;
+    my $min = int ($aval / 60) % 60 ;
+    my $hour = int($aval / 3600) ;
     
-    my $duration = $hour?sprintf('%d:%02d', $hour, $min):$min ;
+    my $duration = ($val<0?'-':'') . ($hour?sprintf('%d:%02d', $hour, $min):$min) ;
     if ($sec != 0)
 	{
 	$duration .= sprintf (':%02d', $sec) ;
 	}
     $fdat{$name} = $duration ;
-
-print STDERR "duration init: $fdat{$name}\n" ;
     }
 
 # ------------------------------------------------------------------------------------------
@@ -75,19 +73,18 @@ sub prepare_fdat
     {
     my ($self, $req) = @_ ;
 
-print STDERR "durx3\n" ;
     my $name    = $self->{name} ;
     my $val     = $fdat{$name} ;
     return if ($val eq '') ;
     
+    my $neg = 0 ;
+    $neg = 1 if ($val =~ s/^\s*-//) ;
     my @vals = split (/:/, $val, 3) ;
      
 
         
     $fdat{$name} = @vals == 1?$vals[0] * 60:$vals[0] * 3600 + $vals[1] * 60 + $vals[2] ;
-
-print STDERR "duration: (@vals) val = $fdat{$name}\n" ;
-
+    $fdat{$name} = - $fdat{$name} if ($neg) ;
     }
 
 1 ;

Modified: perl/embperl/trunk/Embperl/Form/Control/grid.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/grid.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/grid.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/grid.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -234,10 +234,10 @@ $]
     <td class="cBase cGridLabelBox">[+ $self -> form -> convert_label ($self) +]</td>
     [$if !($self -> {readonly}) $]
     <td class="cBase cGridControlBox">
-        <img src="/images/toup.gif" id="cmdUp" name="-up" title="Zeile Hoch" onclick="[+ $jsname +].upRow()">
-        <img src="/images/todown.gif"  id="cmdDown"  name="-down" title="Zeile runter" onclick="[+ $jsname +].downRow()">
-        <img src="/images/button_neu.gif" id="cmdAdd" name="-add" title="Zeile Hinzuf&uuml;gen  Alt-NUM+" onclick="[+ $jsname +].addRow()">
-        <img src="/images/button_loeschen.gif"  id="cmdDelete"  name="-delete" title="Markierte Zeile L&ouml;schen  Alt-NUM-" onclick="[+ $jsname +].delRow()">
+        <img src="[+ $self -> {imagedir} +]/toup.gif" id="cmdUp" name="-up" title="Zeile Hoch" onclick="[+ $jsname +].upRow()">
+        <img src="[+ $self -> {imagedir} +]/todown.gif"  id="cmdDown"  name="-down" title="Zeile runter" onclick="[+ $jsname +].downRow()">
+        <img src="[+ $self -> {imagedir} +]/button_neu.gif" id="cmdAdd" name="-add" title="Zeile Hinzuf&uuml;gen  Alt-NUM+" onclick="[+ $jsname +].addRow()">
+        <img src="[+ $self -> {imagedir} +]/button_loeschen.gif"  id="cmdDelete"  name="-delete" title="Markierte Zeile L&ouml;schen  Alt-NUM-" onclick="[+ $jsname +].delRow()">
     </td>
     [$endif$]
   </tr>

Modified: perl/embperl/trunk/Embperl/Form/Control/mult.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/mult.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/mult.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/mult.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -142,9 +142,13 @@ $]
     -]
   </table>
   <script>
+      $('#[+ $self -> {id} +]').eplgrid () ;
+      [#
+      [+ $jsname +] = new [+ $nsprefix +]Grid (document.getElementById('[+ $self -> {id} +]'),
       [+ $jsname +] = new [+ $nsprefix +]Grid (document.getElementById('[+ $self -> {id} +]'),
                                                document.getElementById('[+ $self -> {id} +]-newrow'),
                                                document.getElementById('[+ $self -> {id} +]-max')) ;
+      #]
   </script>
 [$endsub$]
   
@@ -185,8 +189,9 @@ $]
  
  
  $]
-              <img src="/images/button_plus.gif" id="cmdAdd" name="-add" title="Zeile Hinzuf&uuml;gen" onclick="[+ $jsname +].addRow()">
-              <img src="/images/button_kreuz.gif"  id="cmdDelete"  name="-delete" title="Zeile L&ouml;schen" onclick="[+ $jsname +].delRow()">
+
+              <img src="[+ $self -> {imagedir} +]/button_plus.gif"   id="[+ $self -> {id} +]-add" title="Zeile Hinzuf&uuml;gen">
+              <img src="[+ $self -> {imagedir} +]/button_kreuz.gif"  id="[+ $self -> {id} +]-del" title="Zeile L&ouml;schen">
 [$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=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/selectdyn.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -36,6 +36,7 @@ sub show_control_readonly
     my ($values, $options) = $self -> get_values ($req) ;
     my $initval ;
     my $fdatval = $fdat{$name} ;
+
     my $i = 0 ;
     foreach (@$values)
         {
@@ -77,6 +78,8 @@ __EMBPERL__
 <input type="hidden" name="[+ $self -> {name} +]">
 [$endsub$]
 
+
+
 [# ---------------------------------------------------------------------------
 #
 #   show_control - output the control
@@ -84,6 +87,79 @@ __EMBPERL__
 
 [$ sub show_control ($self, $req, $filter)
 
+    my $name     = $self -> {name} ;
+    #$filter      ||= $self -> {filter} ;
+    #my $addtop   = $self -> {addtop} || [] ;
+    #my $addbottom= $self -> {addbottom} || [] ;
+    my $noscript  = $req -> {epf_no_script} ;
+    my $nsprefix = $self -> form -> {jsnamespace} ;
+    my $jsname = $name ;
+    if ($noscript)
+        {
+        $jsname =~ s/[^a-zA-Z0-9%]/_/g ;
+        }
+    else
+        {
+        $jsname =~ s/[^a-zA-Z0-9]/_/g ;
+        }
+    $self -> {size} ||= 75 / ($self -> {width} || 2) ;
+    my $initval ;
+    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)) ;    
+            }
+        }
+    $target = '' ;
+    $target = "parent.frames.$self->{link_target}." if ($self -> {link_target}) ;
+    $self -> {showurl}      ||= 'ldapTreeData.epl?-id=' ;
+    $self -> {datasrcurl}   ||= '/epfctrl/datasrc.exml' ;
+    
+$]
+<div class="ui-widget">
+[# --- input --- #]
+<input class="cBase cControl cAutoCompInput cControlWidthSelectDyn" id="_inp_[+ $jsname +]" type="text"
+[$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$]
+value="[+ $initval +]"
+>
+<input type="hidden" name="[+ $name +]" id="[+ $jsname +]" >
+<input type="hidden" id="_id_[+ $jsname +]" >
+<script>
+autocomplete_setup($( "#_inp_[+ $jsname +]" ), {
+                        showurl:  '[+ do { local $escmode = 0 ; $self -> {showurl} } +]',
+                        popupurl:  '[+ do { local $escmode = 0 ; $self -> {popupurl} } +]',
+                        datasrcurl:  '[+ do { local $escmode = 0 ; $self -> {datasrcurl} } +]',
+                        datasrc:     '[+ $self->{datasrc} +]',
+                        show_on_select:     '[+ $self->{show_on_select}?'true':'false' +]',
+                        }) ;
+</script>
+
+[$endsub$]
+
+[# ---------------------------------------------------------------------------
+#
+#   show_control - output the control
+#]
+
+[$ sub xshow_control ($self, $req, $filter)
+
     my ($values, $options) = $self -> get_values ($req) ;
     my $name     = $self -> {name} ;
     #$filter      ||= $self -> {filter} ;
@@ -115,6 +191,9 @@ __EMBPERL__
         }
     $target = '' ;
     $target = "parent.frames.$self->{link_target}." if ($self -> {link_target}) ;
+    $showurl      = $self -> {showurl}      ||= 'ldapTreeData.epl?-id=' ;
+    $datasrcurl   = $self -> {datasrcurl}   ||= '/epfctrl/datasrc.exml' ;
+    $datasrcparam = $self -> {datasrcparam} ||= '/epfctrl/datasrc.exml' ;
 $]
 
 <div class="cAutoCompDiv">
@@ -125,7 +204,7 @@ style="display:none; position: absolute;
 border: 2px grey outset; background: white; text-align: left;"
 >
 
-<a href="#" onClick="[+ $target +]location.href='ldapTreeData.epl?-id=' + encodeURIComponent([+ $jsname +]Popup.idval)">Anzeigen</a>&nbsp;
+<a href="#" onClick="[+ $target +]location.href='[+ do { local $escmode = 0 ; $showurl } +]' + encodeURIComponent([+ $jsname +]Popup.idval)">Anzeigen</a>&nbsp;
 
 [*
     my $datasrc_ctrls      = $self -> get_datasource_controls ($req) ;
@@ -154,7 +233,7 @@ border: 2px grey outset; background: whi
 <input class="cBase cControl cAutoCompInput cControlWidthSelectDyn" id="_inp_[+ $jsname +]" type="text"
 [$if $self -> {size} $]size="[+ $self->{size} +]"[$endif$]
 value="[+ $initval +]"
-onDblClick="u='ldapTreeData.epl?-id=' + encodeURIComponent(document.getElementById('[+ $name +]').value);[+ $target +]location.href=u;"
+onDblClick="u='[+ do { local $escmode = 0 ; $showurl } +]' + encodeURIComponent(document.getElementById('[+ $name +]').value);[+ $target +]location.href=u;"
 onContextMenu="[+ $jsname +]Popup.showPopup(); return false ;"
 >
 [#
@@ -173,7 +252,7 @@ onContextMenu="[+ $jsname +]Popup.showPo
                                         document.getElementById('_inp_[+ $jsname +]')) ;
 
         [+ $jsname +]AutoComp = new [+ $nsprefix +]Ajax.Autocompleter(document.getElementById('_inp_[+ $jsname +]'),document.getElementById('_cont_[+ $jsname +]'),
-            '/epfctrl/datasrc.exml', {paramName: "query", parameters: "datasrc=[+ $self -> {datasrc} +]", frequency: 0.3, update: document.getElementById('[+ $name +]')}) ; 
+            '[+ do { local $escmode = 0 ; $datasrcurl } +]', {paramName: "query", parameters: "datasrc=[+ $self -> {datasrc} +]", frequency: 0.3, update: document.getElementById('[+ $name +]')}) ; 
         [+ $jsname +]AutoComp.updateChoices ;
 
 </[$if $noscript $]x-[$endif$]script>
@@ -258,6 +337,33 @@ value (first entry)is displayed. Example
 If given, only items where the value matches the regex given in
 C<filter> are displayed.
 
+=head3 showurl
+
+This URL will be requested if the user clicks on SHOW in the popup or
+double clicks the control. The value of the selected option will be
+appended to that url. Should be something like '/foo/bar.epl?id='.
+NOTE: This URL is not encoded in anyway, so make sure it is properly
+url encoded.
+
+=head3 datasrcurl
+
+This URL will be requested when the user types any input to request
+the data for the control. The characters the users has typed will be
+passed by the parameter query and the name of the datasrc attribute
+will be passed in the datasrc parameter.
+NOTE: This URL is not encoded in anyway, so make sure it is properly
+url encoded.
+
+=head3 show_on_select
+
+If true show the selected item as soon as it is selected (useses showurl)
+
+=head3 $fdat{-init-<name>}
+
+If set this value is used to prefill the input box, if not set get_values
+method of the datasource object is call, which might be take a long time
+in case of many options.
+
 
 =head1 Author
 

Modified: perl/embperl/trunk/Embperl/Form/Control/table.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/table.pm?rev=1075092&r1=1075091&r2=1075092&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/table.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/table.pm Sun Feb 27 17:29:40 2011
@@ -1,7 +1,7 @@
 
 ###################################################################################
 #
-#   Embperl - Copyright (c) 1997-2010 Gerald Richter / ecos gmbh   www.ecos.de
+#   Embperl - Copyright (c) 1997-2005 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.
@@ -36,6 +36,7 @@ __EMBPERL__
 
     my $span = ($self->{width_percent})  ;
     my $showtext = $self -> {showtext} ;
+    my $dataprefix = $self -> {dataprefix} || [''] ;
 $]
 <td class="cBase cTabTD" colspan="[+ $span +]">
 [$if $self -> {text} $]
@@ -51,7 +52,7 @@ $]
 [$foreach $line (@{$self->{columns}}) $]
 <tr style="background: white">
 [$foreach $c (@$line) $]
-<td colspan="[+ ref $c?$c -> [2] || 1:1 +]" class="[+$self -> {line2} || (@{$self->{columns}} > 1 && $i == 0)?'cGridLabelBox':'cControlBox'+]  cLdapReportColumnHead">[+ $showtext?(ref $c?$c -> [1] || $c -> [0]:$c):$self -> form -> convert_label ($self, ref $c?$c -> [1]:$c) +]</td>
+<td colspan="[+ ref $c?$c -> [2] || 1:1 +]" class="[+$self -> {line2} || (@{$self->{columns}} > 1 && $i == 0)?'cGridLabelBox':'cControlBox'+]  cLdapReportColumnHead">[+ $showtext?(ref $c?$c -> [1] || $c -> [0]:$c):$self -> form -> convert_label ($self, undef, ref $c?$c -> [1]:$c) +]</td>
 [$endforeach$]
 [- $i++ -]
 </tr>
@@ -65,7 +66,10 @@ $]
 <tr style="background: white">
 [$foreach $c (@$line) $][-
     $attr = ref $c?$c -> [0]:$c ;
-    $item = $o -> {$attr} ;
+    foreach my $prefix (@$dataprefix)
+        {
+        last if ($prefix?($item = $o -> {$prefix}{$attr}):($item = $o -> {$attr}))
+        }    
     $item = ref $item?join ('; ',@$item):$item ;
     if ($filter = $c -> [6])
 	{
@@ -75,8 +79,24 @@ $]
     -]<td colspan="[+ ref $c?$c -> [2] || 1:1 +]" class="[# +$self -> {line2} || (@{$self->{columns}} > 1 && $i == 0)?'cGridLabelBox':'cControlBox'+ #] cLdapReportTd" style="[+ $self -> cellstyle ($item, $o, $r, $i, $attr) +]">[$ if $c -> [3] && ($item =~ /^&(.*?),(.*?),(.*)$/) $]
             [$ if $1 eq 'checkbox' $]<input type="checkbox" name="[+ $2 +]" value="[+ $3 +]">[$endif$]
             [$ if $1 eq 'radio' $]<input type="radio" name="[+ $2 +]" value="[+ $3 +]">[$endif$]
-            [$elsif ($c -> [4] && $o -> {$c -> [4]}) $]<a href="[+ do { local $escmode = 0 ; $o -> {$c -> [4]} } +]" target="[+ $c -> [5] +]">[+ ref $item?join ('; ',@$item):$item +]</a>
-            [$else$][+ ref $item?join ('; ',@$item):$item +][$endif$]</td>
+            [$else $][-
+                $href = undef ;
+                $link = $c -> [4] ;
+                if (ref $link eq 'CODE')
+                    {
+                    $href = &$link ($o) ;    
+                    }
+                elsif ($link)
+                    {
+                    $href = $o -> {$link} ;    
+                    }
+                $link = $c -> [7] ;
+                if (ref $link eq 'CODE')
+                    {
+                    $id = &$link ($o) ;    
+                    }
+             -][$ if ($href) $]<a href="[+ do { local $escmode = 0 ; $href } +]" target="[+ $c -> [5] +]" [$if ($id) $]id="[+ "$self->{name}_$attr_$i" +][$endif$]>[+ ref $item?join ('; ',@$item):$item +]</a>
+            [$else$][+ ref $item?join ('; ',@$item):$item +][$endif$][$endif$][$if ($id) $]<script>add_qtip($('[+ "$self->{name}_$attr_$i"+]'), '[+ $id +]')</script>[$endif$]</td>
 [$endforeach$]
 [- $i++ -]
 </tr>



---------------------------------------------------------------------
To unsubscribe, e-mail: qroberts@example.com
For additional commands, e-mail: qroberts@example.com


From embperlqroberts@example.com Sun Feb 27 20:26:23 2011
Return-Path: <embperlqroberts@example.com>
Delivered-To: qroberts@example.com
Received: (qmail 56412 invoked from network); 27 Feb 2011 20:26:23 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 27 Feb 2011 20:26:23 -0000
Received: (qmail 84135 invoked by uid 500); 27 Feb 2011 20:26:23 -0000
Delivered-To: qroberts@example.com
Received: (qmail 84125 invoked by uid 500); 27 Feb 2011 20:26:23 -0000
Mailing-List: contact qroberts@example.com; run by ezmlm
Precedence: bulk
list-help: <mailto:qroberts@example.com>
list-unsubscribe: <mailto:qroberts@example.com>
List-Post: <mailto:qroberts@example.com>
List-Id: <embperl-cvs.perl.apache.org>
Delivered-To: mailing list qroberts@example.com
Received: (qmail 84118 invoked by uid 99); 27 Feb 2011 20:26:22 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Feb 2011 20:26:22 +0000
X-ASF-Spam-Status: No, hits=-2000.0 required=5.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Feb 2011 20:26:22 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 331BF238899C; Sun, 27 Feb 2011 20:26:02 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r1075135 - /perl/embperl/trunk/Embperl/Form/Control/table.pm
Date: Sun, 27 Feb 2011 20:26:02 -0000
To: qroberts@example.com
From: qroberts@example.com
X-Mailer: svnmailer-1.0.8
Message-Id: <qroberts@example.com>

Author: richter
Date: Sun Feb 27 20:26:01 2011
New Revision: 1075135

URL: http://svn.apache.org/viewvc?rev=1075135&view=rev
Log:
table control

Modified:
    perl/embperl/trunk/Embperl/Form/Control/table.pm

Modified: perl/embperl/trunk/Embperl/Form/Control/table.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/table.pm?rev=1075135&r1=1075134&r2=1075135&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/table.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/table.pm Sun Feb 27 20:26:01 2011
@@ -63,6 +63,7 @@ $]
 [$foreach $o (@$data) $]
 [- $i = 0 -]
 [$foreach $line (@{$self->{columns}}) $]
+[- $colnum = 0 -]
 <tr style="background: white">
 [$foreach $c (@$line) $][-
     $attr = ref $c?$c -> [0]:$c ;
@@ -76,10 +77,12 @@ $]
 	die "unknown filter '$filter'" if (!($filtercode = $self -> {filters}{$filter})) ;
 	$item = &{$filtercode}($item, $c, $o, $epreq) ;
 	}
-    -]<td colspan="[+ ref $c?$c -> [2] || 1:1 +]" class="[# +$self -> {line2} || (@{$self->{columns}} > 1 && $i == 0)?'cGridLabelBox':'cControlBox'+ #] cLdapReportTd" style="[+ $self -> cellstyle ($item, $o, $r, $i, $attr) +]">[$ if $c -> [3] && ($item =~ /^&(.*?),(.*?),(.*)$/) $]
+    $id   = undef ;
+    -]<td colspan="[+ ref $c?$c -> [2] || 1:1 +]" class="[# +$self -> {line2} || (@{$self->{columns}} > 1 && $i == 0)?'cGridLabelBox':'cControlBox'+ #] cLdapReportTd" style="[+ $self -> cellstyle ($item, $o, $r, $i, $attr) +]">
+        [$ if $c -> [3] && ($item =~ /^&(.*?),(.*?),(.*)$/) $]
             [$ if $1 eq 'checkbox' $]<input type="checkbox" name="[+ $2 +]" value="[+ $3 +]">[$endif$]
             [$ if $1 eq 'radio' $]<input type="radio" name="[+ $2 +]" value="[+ $3 +]">[$endif$]
-            [$else $][-
+        [$else $][-
                 $href = undef ;
                 $link = $c -> [4] ;
                 if (ref $link eq 'CODE')
@@ -95,8 +98,15 @@ $]
                     {
                     $id = &$link ($o) ;    
                     }
-             -][$ if ($href) $]<a href="[+ do { local $escmode = 0 ; $href } +]" target="[+ $c -> [5] +]" [$if ($id) $]id="[+ "$self->{name}_$attr_$i" +][$endif$]>[+ ref $item?join ('; ',@$item):$item +]</a>
-            [$else$][+ ref $item?join ('; ',@$item):$item +][$endif$][$endif$][$if ($id) $]<script>add_qtip($('[+ "$self->{name}_$attr_$i"+]'), '[+ $id +]')</script>[$endif$]</td>
+             -][$ if ($href)
+                $]<a href="[+ do { local $escmode = 0 ; $href } +]" target="[+ $c -> [5] +]" [$if ($id) $]id="[+ "$self->{name}_${attr}_$r" +]"[$endif$]>[+ ref $item?join ('; ',@$item):$item +]</a>
+            [$else
+                $][+ ref $item?join ('; ',@$item):$item
+            +][$endif$]
+        [$endif$][$
+        if ($id) $]<script>add_qtip($('[+ "#$self->{name}_${attr}_$r"+]'), '[+ $id +]')</script>[$endif$]
+    </td>
+[- $colnum++ -]
 [$endforeach$]
 [- $i++ -]
 </tr>



---------------------------------------------------------------------
To unsubscribe, e-mail: qroberts@example.com
For additional commands, e-mail: qroberts@example.com



{'source': 'Apache Software Foundation Public Mail Archives'}