Author: sid.gbf
Date: 2010-03-15 21:09:30 +0100 (Mon, 15 Mar 2010)
New Revision: 28534

Modified:
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_field.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
Log:
More fixes and improvements



Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_field.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_field.php
   2010-03-15 17:13:11 UTC (rev 28533)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_field.php
   2010-03-15 20:09:30 UTC (rev 28534)
@@ -11,8 +11,8 @@
     [?php include_partial('<?php echo $this->getModuleName() ?>/form_field', 
array(
       'name'       => $ename,
       'attributes' => array(),
-      'label'      => '',
-      'help'       => '',
+      'label'      => null,
+      'help'       => null,
       'form'       => $eform,
       'field'      => $efield,
       'force_show' => true,
@@ -22,6 +22,13 @@
 [?php else: ?]
   <div class="[?php echo $class ?][?php $form[$name]->hasError() and print ' 
errors' ?]">
     [?php echo $form[$name]->renderError() ?]
+    [?php if (!$help || is_null($help)): ?]
+      [?php if ($form[$name]->renderHelp()): ?]
+        [?php $help = $form[$name]->renderHelp(); ?]
+      [?php else: ?]
+        [?php $help = getDefaultHint(); ?]
+      [?php endif; ?]
+    [?php endif; ?]
     <div>
       [?php echo $form[$name]->renderLabel($label) ?]
       <div class="content_view" id="[?php echo $form[$name]->renderId(); 
?]_view" style="display: none;">
@@ -31,10 +38,7 @@
           <div class="content">[?php echo $form[$name]->render($attributes 
instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes) ?]</div>
 
           [?php if ($help): ?]
-            <div class="help">[?php echo __($help, array(), '<?php echo 
$this->getI18nCatalogue() ?>') ?]</div>
-          [?php elseif ($help = $form[$name]->renderHelp()): ?]
-          [?php else: ?]
-            <div class="help">[?php echo getDefaultHint(); ?]</div>
+            <div class="help">[?php echo $help ?]</div>
           [?php endif; ?]
       </div>
     </div>

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
    2010-03-15 17:13:11 UTC (rev 28533)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
    2010-03-15 20:09:30 UTC (rev 28534)
@@ -5,14 +5,15 @@
 
   function content_to_view(sfFormField $field, $attributes, $help) {
     $value = '';
+
     if($field->getValue()) {
       $value = $field->getValue();
     } else if($help) {
       $value = $help;
-    } else if($field->renderHelp()) {
+/*    } else if($field->renderHelp()) {
       $value = $field->renderHelp();
     } else {
-      $value = getDefaultHint();
+      $value = getDefaultHint();*/
     }
 
     return $value;
@@ -46,11 +47,21 @@
   }
   function _generate_functions_for_field($fieldName, $field) {
     $command = '';
-    $command .= '  if(document.getElementById("'.$field->renderId().'_temp")) 
{' . "\r\n";
-    $command .= '    jQuery("#'.$field->renderId().'_temp").change( function() 
{ reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n";
-    $command .= '  } else {' . "\r\n";
-    $command .= '    jQuery("#'.$field->renderId().'").blur( function() { 
reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n";
-    $command .= '  }' . "\r\n";
+    switch($field->getWidget()->getOption('type')) {
+      case 'text': {
+        $command .= '    jQuery("#'.$field->renderId().'").blur( function() { 
reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n";
+        break;
+      }
+      case 'datepicker': {
+        $command .= '    jQuery("#'.$field->renderId().'_temp").change( 
function() { reset_function(); update_values("'.$field->renderId().'") } );' . 
"\r\n";
+        break;
+      }
+      case 'fckeditor': {
+        echo javascript_tag('function FCKeditor_OnComplete(editor) { 
editor.Events.AttachEvent("OnBlur", function(editor) { 
jQuery("#'.$field->renderId().'").val(editor.GetHTML()); reset_function(); 
update_values("'.$field->renderId().'"); }); }' . "\r\n");
+        $command .= '//FCKEditor is Outsite :) ' . "\r\n";
+        break;
+      }
+    }
     $command .= '  jQuery("#'.$field->renderId().'_view").click( function() { 
switch_field("'.$field->renderId().'") } );' . "\r\n";
     return $command;
   }
@@ -87,7 +98,7 @@
   } else {
     newValue = jQuery("#"+fieldName).val();
   }
-  if(newValue == null) {
+  if(newValue == null || newValue == "") {
     newValue = jQuery("#"+fieldName+"_edit > .help").html();
   }
   jQuery("#"+fieldName+"_view > .help").html(newValue);

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to