Author: richter
Date: Sat Apr 22 06:17:34 2006
New Revision: 396122

URL: http://svn.apache.org/viewcvs?rev=396122&view=rev
Log:
datasource class base code & tinymce integration

Added:
    perl/embperl/trunk/Embperl/Form/Control/tinymce.pm   (with props)
    perl/embperl/trunk/Embperl/Form/DataSource/
    perl/embperl/trunk/Embperl/Form/DataSource.pm
Modified:
    perl/embperl/trunk/Embperl/Form/Control.pm
    perl/embperl/trunk/Embperl/Form/ControlMultValue.pm

Modified: perl/embperl/trunk/Embperl/Form/Control.pm
URL: 
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control.pm?rev=396122&r1=396121&r2=396122&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control.pm Sat Apr 22 06:17:34 2006
@@ -32,17 +32,33 @@
     {
     my ($class, $args) = @_ ;
     
-    bless $args, $class ;
+    my $self = { %$args } ;
+    bless $self, $class ;
     
-    return $args ;
+    $self -> init ;
+    
+    return $self ;
+    }
+
+# ---------------------------------------------------------------------------
+#
+#   init - init the new control
+#
+
+sub init
+
+    {
+    my ($self) = @_ ;
+    
+    return $self ;
     }
     
+        
 # ---------------------------------------------------------------------------
 #
 #   noframe - do not draw frame border if this is the only control
 #
 
-
 sub noframe
 
     {
@@ -54,7 +70,6 @@
 #   is_disabled - do not display this control at all
 #
 
-
 sub is_disabled
 
     {
@@ -68,7 +83,6 @@
 #   is_readonly - could value of this control be changed ?
 #
 
-
 sub is_readonly
 
     {
@@ -77,8 +91,6 @@
     return $self -> {readonly} ;
     }
 
-
-
 # ---------------------------------------------------------------------------
 #
 #   show - output the control
@@ -118,7 +130,6 @@
     return ;
     }
 
-
 # ---------------------------------------------------------------------------
 #
 #   form - return form object
@@ -131,7 +142,6 @@
     return $Embperl::Form::forms{$self -> {formid}} ;
     }
 
-
 # ---------------------------------------------------------------------------
 #
 #   get_validate_rules - get rules for validation
@@ -275,6 +285,10 @@
 
 Create a new control
 
+=head2 init
+
+Init the new control
+
 =head2 noframe
 
 Do not draw frame border if this is the only control
@@ -353,7 +367,7 @@
 
 =head2 readonly
 
-If set, displays a readonly version of t control.
+If set, displays a readonly version of the control.
 
 =head2 disable
 
@@ -376,6 +390,10 @@
 With this parameter you can also specify the width of
 the control in percent. This parameter take precendence over
 C<width>
+
+=head2 default
+
+Default value of the control
 
 =head1 AUTHOR
 

Added: perl/embperl/trunk/Embperl/Form/Control/tinymce.pm
URL: 
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/Control/tinymce.pm?rev=396122&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/tinymce.pm (added)
+++ perl/embperl/trunk/Embperl/Form/Control/tinymce.pm Sat Apr 22 06:17:34 2006
@@ -0,0 +1,114 @@
+
+###################################################################################
+#
+#   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 Embperl::Form::Control::tinymce ;
+
+use strict ;
+use base 'Embperl::Form::Control' ;
+
+use Embperl::Inline ;
+
+1 ;
+
+__EMBPERL__
+    
+[# ---------------------------------------------------------------------------
+#
+#   show_control - output the control
+#]
+
+[$ sub show_control ($self) $]
+
+<script language="javascript" type="text/javascript" 
src="/tiny_mce/tiny_mce.js"></script>
+<script language="javascript" type="text/javascript">
+       tinyMCE.init({
+               mode : "textareas",
+               theme : "advanced",
+               plugins : 
"table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable",
+                theme_advanced_buttons1 : 
"bold,italic,underline,strikethrough,bullist,numlist,outdent,indent,undo,redo,link,unlink,image,code,hr,sub,sup,forecolor,backcolor,charmap,anchor,table,search,replace",
+                theme_advanced_buttons2 : 
"removeformat,formatselect,fontselect,fontsizeselect,fullscreen,insertdate,inserttime",
+                theme_advanced_buttons3 : "",
+                theme_advanced_toolbar_location : "top",
+               theme_advanced_toolbar_align : "left",
+               theme_advanced_path_location : "bottom",
+               content_css : "example_full.css",
+                plugin_insertdate_dateFormat : "%d.%m.%Y",
+                plugin_insertdate_timeFormat : "%H:%M:%S",
+               extended_valid_elements : 
"hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
+               xtheme_advanced_resize_horizontal : false,
+               theme_advanced_resizing : true,
+                editor_selector : "cBase cControl cMceEditor",
+                width: "100%"
+       });
+</script>
+
+<textarea type="text"  class="cBase cControl cMceEditor"  name="[+ 
$self->{name} +]"
+[$if $self -> {cols} $]cols="[+ $self->{cols} +]"[$endif$]
+[$if $self -> {rows} $]rows="[+ $self->{rows} +]"[$endif$]
+></textarea>
+[$endsub$]
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::Control::tinymce - A tinymce input control inside an Embperl 
Form
+
+
+=head1 SYNOPSIS
+
+  { 
+  type => 'tinymce',
+  text => 'blabla', 
+  name => 'foo',
+  rows => 10,
+  cols => 80,
+  }
+
+=head1 DESCRIPTION
+
+Used to create an input control inside an Embperl Form.
+See Embperl::Form on how to specify parameters.
+
+=head2 PARAMETER
+
+=head3 type
+
+Needs to be 'tinymce'
+
+=head3 text 
+
+Will be used as label for the text input control
+
+=head3 cols
+
+Number of columns
+
+=head3 rows
+
+Number of rows
+
+=head1 Author
+
+G. Richter ([EMAIL PROTECTED])
+
+=head1 See Also
+
+perl(1), Embperl, Embperl::Form
+
+

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

Modified: perl/embperl/trunk/Embperl/Form/ControlMultValue.pm
URL: 
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/ControlMultValue.pm?rev=396122&r1=396121&r2=396122&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/ControlMultValue.pm (original)
+++ perl/embperl/trunk/Embperl/Form/ControlMultValue.pm Sat Apr 22 06:17:34 2006
@@ -23,6 +23,28 @@
 
 # ---------------------------------------------------------------------------
 #
+#   init - Init the new control
+#
+
+
+sub init
+
+    {
+    my ($self) = @_ ;
+    
+    if ($self -> {datasrc})
+        {
+        my $form = $self -> form ;
+        my $packages = $form -> get_datasrc_packages ;
+        my $self -> {datasrcobj} = $form -> new_object ($packages, $self -> 
{datasrc}, $self) ;
+        }
+        
+    return $self ;
+    }
+    
+
+# ---------------------------------------------------------------------------
+#
 #   get_values - returns the values and options
 #
 
@@ -31,6 +53,7 @@
     {
     my ($self) = @_ ;
 
+    return $self -> {datasrcobj} -> get_values if ($self -> {datasrcobj}) ;
     return ($self -> {values}, $self -> {options}) ;
     }
 
@@ -65,5 +88,64 @@
     }
 
 
-  1 ;
-  
\ No newline at end of file
+1 ;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::ControlMultValue - Base class for controls inside
+an Embperl Form which have multiple values to select from, like
+a select box or radio buttons.
+
+
+=head1 SYNOPSIS
+
+Do not use directly, instead derive a class
+
+=head1 DESCRIPTION
+
+This class is not used directly, it is used as a base class for
+all controls which have multiple values to select from inside
+an Embperl Form. It provides a set of methods
+that could be overwritten to customize the behaviour of your controls.
+
+=head1 METHODS
+
+=head2 get_values
+
+returns the values and options
+
+=head2 get_active_id
+
+get the id of the value which is currently active
+
+=head1 PARAMETERS
+
+=head3 values
+
+Arrayref with the values to select from. This is what gets
+submited back to the server.
+
+=head3 options
+
+Arrayref with the options to select from. This is what the user sees.
+
+=head3 datasrc
+
+Name of an class which provides the values for the
+values and options parameters. Either a full package name or
+a name, in which case all packages which are returned
+by Embperl::Form::get_datasrc_packages are searched.
+
+=head1 AUTHOR
+
+G. Richter ([EMAIL PROTECTED])
+
+=head1 SEE ALSO
+
+perl(1), Embperl, Embperl::Form, Embperl::From::Control, 
Embperl::Form::DataSource
+
+    
\ No newline at end of file

Added: perl/embperl/trunk/Embperl/Form/DataSource.pm
URL: 
http://svn.apache.org/viewcvs/perl/embperl/trunk/Embperl/Form/DataSource.pm?rev=396122&view=auto
==============================================================================
--- perl/embperl/trunk/Embperl/Form/DataSource.pm (added)
+++ perl/embperl/trunk/Embperl/Form/DataSource.pm Sat Apr 22 06:17:34 2006
@@ -0,0 +1,105 @@
+
+###################################################################################
+#
+#   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 Embperl::Form::DataSource ;
+
+use strict ;
+
+# ---------------------------------------------------------------------------
+#
+#   new - create a new datasource object
+#
+
+
+sub new
+
+    {
+    my ($class, $args) = @_ ;
+    
+    my $self = {} ;
+    bless $self, $class ;
+    
+    $self -> init ($args) ;
+    
+    return $self ;
+    }
+
+# ---------------------------------------------------------------------------
+#
+#   init - init the new datasource object
+#
+
+sub init
+
+    {
+    my ($self) = @_ ;
+    
+    return $self ;
+    }
+    
+# ---------------------------------------------------------------------------
+#
+#   get_values - returns the values and options
+#
+
+sub get_values
+
+    {
+    my ($self) = @_ ;
+
+    die "Please overwrite get_values in " . ref $self ;
+    }
+
+1 ;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Embperl::Form::DataSource - Base class for data source objects
+which provides the data for ControlMutlValue objects.
+
+
+=head1 SYNOPSIS
+
+Do not use directly, instead derive a class
+
+=head1 DESCRIPTION
+
+This class is not used directly, it is used as a base class for
+all data source objects.
+It provides a set of methods
+that could be overwritten to customize the behaviour of your controls.
+
+=head1 METHODS
+
+=head2 get_values
+
+returns the values and options. Must be overwritten.
+
+
+=head1 AUTHOR
+
+G. Richter ([EMAIL PROTECTED])
+
+=head1 SEE ALSO
+
+perl(1), Embperl, Embperl::Form, Embperl::From::ControlMultValue
+
+        
+        



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to