You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl-cvs@perl.apache.org by ri...@apache.org on 2012/07/09 05:51:15 UTC

svn commit: r1358902 - in /perl/embperl/trunk/Embperl/Form/Control: grid.pm textarea.pm tinymce.pm

Author: richter
Date: Mon Jul  9 03:51:15 2012
New Revision: 1358902

URL: http://svn.apache.org/viewvc?rev=1358902&view=rev
Log:
Embperl::Form controls

Modified:
    perl/embperl/trunk/Embperl/Form/Control/grid.pm
    perl/embperl/trunk/Embperl/Form/Control/textarea.pm
    perl/embperl/trunk/Embperl/Form/Control/tinymce.pm

Modified: perl/embperl/trunk/Embperl/Form/Control/grid.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/grid.pm?rev=1358902&r1=1358901&r2=1358902&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/grid.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/grid.pm Mon Jul  9 03:51:15 2012
@@ -235,8 +235,15 @@ sub prepare_fdat
         $val = $ldap?ecos::LdapBase -> joinAttrValue(\@data):\@data ;
         push @rows, $val if (!$empty) ;    
         }
-    $fdat->{$name} = \@rows ;
-    
+    if ($self -> {datatype} eq 'hash')
+        {
+        $fdat->{$name} = { map { ($_->[1] => $_->[2]) } @rows } ;
+        }
+    else
+        {
+        $fdat->{$name} = \@rows ;
+        }
+        
     foreach my $key (keys %$fdat)
         {
         delete $fdat->{$key} if ($key =~ /^__\Q$name\E_/) ;

Modified: perl/embperl/trunk/Embperl/Form/Control/textarea.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/textarea.pm?rev=1358902&r1=1358901&r2=1358902&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/textarea.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/textarea.pm Mon Jul  9 03:51:15 2012
@@ -32,12 +32,14 @@ __EMBPERL__
 
 [$ sub show_control ($self, $req) 
 my $class = $self -> {class} ||= '' ;
+my ($attrs, $ctrlid, $name) = $self -> get_std_control_attr($req)  ;
 $]
 
-<textarea type="text" name="[+ $self -> {force_name} || $self -> {name} +]"  [+ do { local $escmode = 0 ; $self -> get_std_control_attr($req) } +]
+<textarea type="text" name="[+ $self -> {force_name} || $self -> {name} +]"  [+ do { local $escmode = 0 ; $attrs} +]
 [# [$if $self -> {cols} $]cols="[+ $self->{cols} +]"[$endif$] #]
 [$if $self -> {rows} $]rows="[+ $self->{rows} +]"[$endif$]
 ></textarea>
+[* return $ctrlid ; *]
 [$endsub$]
 
 

Modified: perl/embperl/trunk/Embperl/Form/Control/tinymce.pm
URL: http://svn.apache.org/viewvc/perl/embperl/trunk/Embperl/Form/Control/tinymce.pm?rev=1358902&r1=1358901&r2=1358902&view=diff
==============================================================================
--- perl/embperl/trunk/Embperl/Form/Control/tinymce.pm (original)
+++ perl/embperl/trunk/Embperl/Form/Control/tinymce.pm Mon Jul  9 03:51:15 2012
@@ -17,7 +17,7 @@
 package Embperl::Form::Control::tinymce ;
 
 use strict ;
-use base 'Embperl::Form::Control' ;
+use base 'Embperl::Form::Control::textarea' ;
 
 use Embperl::Inline ;
 
@@ -30,8 +30,49 @@ __EMBPERL__
 #   show_control - output the control
 #]
 
-[$ sub show_control ($self) $]
+[$ sub show_control ($self, $req) 
 
+my $options = $self -> {tinymce} || {} ;
+foreach my $k (keys %$options)
+    {
+    my $v = $options -> {$k} ;
+    $v =~ s/\'/\"/g ;
+    $options -> {$k} = $v if ($v =~ s/%%(.+?)%%/$fdat{$1}/g) ;
+    }
+::dbg(\%fdat) ;
+$]
+
+[- $ctrlid = $self -> SUPER::show_control ($req) ; -]
+<script>
+$('#[+ $ctrlid +]').tinymce({
+	script_url : '/_appserv/js/tiny_mce/tiny_mce.js',
+	theme : "advanced",
+	//plugins : "table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable",
+	plugins : "insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable,autoresize,inlinepopups",
+   dialog_type : "modal",
+	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,styleselect,bullist,numlist,outdent,indent,undo,redo,link,unlink,image,sub,sup,charmap,insertdate,inserttime,search,replace,fullscreen",
+	theme_advanced_buttons2 : '', //"print,cut,copy,pastetext,pasteword,selectall",
+	theme_advanced_buttons3 : "",
+	theme_advanced_toolbar_location : "top",
+	theme_advanced_toolbar_align : "left",
+	theme_advanced_path : false,
+	//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]",
+	theme_advanced_resizing : true,
+	inline_styles : false,
+    [$ foreach my $k (keys %$options) $] 
+    [+ $k +] : '[+ $options -> {$k} +]',
+    [$endforeach$]
+	onchange_callback : function () 
+		{ 
+		$('#[+ $ctrlid +]').trigger ('input_changed') ; 
+		}
+    
+   });
+</script>
+[#
 <script language="javascript" type="text/javascript" src="/tiny_mce/tiny_mce.js"></script>
 [$ if $self -> {theme} ne 'big' $]
 <script language="javascript" type="text/javascript">
@@ -78,11 +119,8 @@ __EMBPERL__
 	});
 </script>
 [$endif$]
+#]
 
-<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__



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-cvs-help@perl.apache.org