Development

Changeset 7212

You must first sign up to be able to contribute.

Changeset 7212

Show
Ignore:
Timestamp:
01/29/08 16:51:38 (10 months ago)
Author:
KRavEN
Message:

Added extjs_escape_json_string to ExtJsHelper? to escape string the same way json_encode does

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfExtjsThemePlugin/lib/helper/ExtjsHelper.php

    r7018 r7212  
    3535} 
    3636 
    37 // TODO: check http://extjs.com/forum/showthread.php?t=9171&highlight=overwrite+css 
    38 // it is about autocompletion, might contain something usefull about being able to enter new values (not only the ones that are already in the foreign-store) 
    3937function extjs_form_combobox($options) 
    4038{ 
    4139  $defaultOptions = array('displayField' => 'REQUIRED', 
    42                           'queryParam' => 'filters[REQUIRED]', 
    43                           'pageSize' => 20, 
     40                          'triggerAction' => 'all', 
    4441                          'typeAhead' => true, 
    4542                          'minChars' => 2, 
    4643                          'mode' => 'remote', 
     44                          'pageSize' => 15, 
    4745                          'lazyRender' => true, 
    48                           'triggerAction' => 'all', 
    49                           'listClass' => 'x-combo-list-small' 
    50 //                          'plugins' => 'new Ext.ux.ComboBoxHandler()' 
    51                         ); 
     46                          'queryParam' => 'filters[REQUIRED]', 
     47                          'listClass' => 'x-combo-list-small'); 
    5248 
    5349  $options = array_merge($defaultOptions, $options); 
    5450 
    55   return _extjs_write_class('ux.ComboBoxAutoLoad', array($options), true); 
     51  return _extjs_write_class('form.ComboBox', array($options), true); 
    5652} 
    5753 
     
    8177  //TODO: CHECK TYPES, apparantly integer does not exists but is int already... are they maybe switched? 
    8278  //I now return $type, if not found. 
    83   if (in_array($type, array('date', 'datetime', 'time', 'timestamp'))
     79  if ($type == 'date' || $type == 'time' || $type == 'timestamp'
    8480  { 
    8581    return 'date'; 
     
    9187  } 
    9288 
    93   if (in_array($type, array('float', 'double'))) 
     89  if (($type === 'float') || ($type === 'double')) 
    9490  { 
    9591    return 'float'; 
    9692  } 
    9793 
    98   if ($type == 'integer') 
     94  if ($type === 'integer') 
    9995  { 
    10096    return 'int'; 
     
    214210  return null; 
    215211} 
     212 
     213function extjs_escape_json_string($string) 
     214{ 
     215  $escape = array("\r\n" => '\n', "\r" => '\n', "\n" => '\n', '"' => '\"', "'" => "\\'"); 
     216  return str_replace(array_keys($escape), array_values($escape), $string); 
     217} 
    216218?>