Development

Changeset 28533

You must first sign up to be able to contribute.

Changeset 28533

Show
Ignore:
Timestamp:
03/15/10 18:13:11 (3 years ago)
Author:
sid.gbf
Message:

Updates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form.php

    r28432 r28533  
    1 [?php use_helper('JavascriptAdmin'); ?] 
     1[?php use_helper('JavascriptBase', 'JavascriptAdmin'); ?] 
    22[?php form_event_handlers($form); ?] 
    33[?php use_stylesheets_for_form($form) ?] 
  • plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_field.php

    r28432 r28533  
    1 [?php if ($field->isPartial()): ?] 
     1[?php $force_show = isset($force_show); ?] 
     2[?php if (!$force_show && $field->isPartial()): ?] 
    23  [?php include_partial('<?php echo $this->getModuleName() ?>/'.$name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?] 
    3 [?php elseif ($field->isComponent()): ?] 
     4[?php elseif (!$force_show && $field->isComponent()): ?] 
    45  [?php include_component('<?php echo $this->getModuleName() ?>', $name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?] 
     6[?php elseif (!$force_show && !$field->isReal() && (get_class($form[$name]) == 'sfFormFieldSchema')): ?] 
     7  [?php echo $form[$name]->renderHiddenFields(); ?] 
     8  [?php $eform = $form[$name]; ?] 
     9  [?php foreach ($eform as $ename => $efield): ?] 
     10    [?php if ((isset($eform[$ename]) && $eform[$ename]->isHidden()) || (!isset($eform[$ename]) && $efield->isReal())) continue ?] 
     11    [?php include_partial('<?php echo $this->getModuleName() ?>/form_field', array( 
     12      'name'       => $ename, 
     13      'attributes' => array(), 
     14      'label'      => '', 
     15      'help'       => '', 
     16      'form'       => $eform, 
     17      'field'      => $efield, 
     18      'force_show' => true, 
     19      'class'      => 'sf_admin_form_row sf_admin_'.strtolower($efield->getWidget()->getOption('type')).' sf_admin_form_field_'.$ename, 
     20    )) ?] 
     21  [?php endforeach; ?] 
    522[?php else: ?] 
    623  <div class="[?php echo $class ?][?php $form[$name]->hasError() and print ' errors' ?]"> 
  • plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php

    r28432 r28533  
    11<?php 
    22  function getDefaultHint() { 
    3     return __(sfConfig::get('app_default_hint', '<em>Clique aqui para definir um valor</em>'))
     3    return '<em>'.__(sfConfig::get('app_default_hint', 'Clique aqui para definir um valor')).'</em>'
    44  } 
    55 
     
    2121    include_jquery(); 
    2222    $command = 'jQuery(document).ready(function () {'."\r\n"; 
    23     foreach($form as $fieldName => $field) { 
    24       if($field->isHidden()) 
    25         continue; 
    26       $command .= '  if(document.getElementById("'.$field->renderId().'_temp")) {' . "\r\n"; 
    27       $command .= '    jQuery("#'.$field->renderId().'_temp").change( function() { reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n"; 
    28       $command .= '  } else {' . "\r\n"; 
    29       $command .= '    jQuery("#'.$field->renderId().'").blur( function() { reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n"; 
    30       $command .= '  }' . "\r\n"; 
    31       $command .= '  jQuery("#'.$field->renderId().'_view").click( function() { switch_field("'.$field->renderId().'") } );' . "\r\n"; 
    32     } 
     23    $command .= _process_form($form); 
    3324    $command .= '  reset_function();'."\r\n"; 
    3425    $command .= '});'."\r\n"; 
     
    3829    $command .= _form_switch_function(); 
    3930    $command .= _form_update_values_function(); 
     31 
    4032    echo javascript_tag($command); 
     33  } 
     34  function _process_form($form) { 
     35    $command = ''; 
     36    foreach($form as $fieldName => $field) { 
     37      if($field->isHidden()) 
     38        continue; 
     39      if(get_class($field) == 'sfFormFieldSchema') { 
     40        $command .= _process_form($field); 
     41      } else { 
     42        $command .= _generate_functions_for_field($fieldName, $field); 
     43      } 
     44    } 
     45    return $command; 
     46  } 
     47  function _generate_functions_for_field($fieldName, $field) { 
     48    $command = ''; 
     49    $command .= '  if(document.getElementById("'.$field->renderId().'_temp")) {' . "\r\n"; 
     50    $command .= '    jQuery("#'.$field->renderId().'_temp").change( function() { reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n"; 
     51    $command .= '  } else {' . "\r\n"; 
     52    $command .= '    jQuery("#'.$field->renderId().'").blur( function() { reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n"; 
     53    $command .= '  }' . "\r\n"; 
     54    $command .= '  jQuery("#'.$field->renderId().'_view").click( function() { switch_field("'.$field->renderId().'") } );' . "\r\n"; 
     55    return $command; 
    4156  } 
    4257  function _form_hide_fields_function() { 
     
    7388    newValue = jQuery("#"+fieldName).val(); 
    7489  } 
    75   if(newValue == "") { 
     90  if(newValue == null) { 
    7691    newValue = jQuery("#"+fieldName+"_edit > .help").html(); 
    7792  } 
     
    8095}'."\r\n"; 
    8196  } 
     97/*if(!function_exists('javascript_tag')) { 
    8298  function javascript_tag($content) 
    8399  { 
    84100    return content_tag('script', javascript_cdata_section($content), array('type' => 'text/javascript')); 
    85101  } 
    86  
     102
     103if(!function_exists('javascript_cdata_section')) { 
    87104  function javascript_cdata_section($content) 
    88105  { 
    89106    return "\n//".cdata_section("\n$content\n//")."\n"; 
    90107  } 
     108}*/ 
    91109  function include_jquery() { 
    92110    $jquery = sfConfig::get('app_jquery_path', '/jquery.js');