Changeset 8851
- Timestamp:
- 05/08/08 00:45:35 (5 months ago)
- Files:
-
- branches/dwhittle/1.0/lib/helper/JavascriptHelper.php (modified) (3 diffs)
- branches/dwhittle/1.0/lib/helper/ObjectAdminHelper.php (modified) (1 diff)
- branches/dwhittle/1.0/lib/helper/UrlHelper.php (modified) (6 diffs)
- branches/dwhittle/1.0/lib/helper/sfRichTextEditorFCK.class.php (modified) (1 diff)
- branches/dwhittle/1.0/lib/helper/sfRichTextEditorTinyMCE.class.php (modified) (2 diffs)
- branches/dwhittle/1.0/lib/request/sfWebRequest.class.php (modified) (1 diff)
- branches/dwhittle/1.0/test/unit/helper/FormHelperTest.php (modified) (2 diffs)
- branches/dwhittle/1.0/test/unit/helper/UrlHelperTest.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/cache/sfAPCCache.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/cache/sfMemcacheCache.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/cache/sfXCacheCache.class.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/helper/FormHelper.php (modified) (3 diffs)
- branches/dwhittle/1.1/lib/helper/JavascriptHelper.php (modified) (5 diffs)
- branches/dwhittle/1.1/lib/helper/ObjectAdminHelper.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/helper/UrlHelper.php (modified) (7 diffs)
- branches/dwhittle/1.1/lib/helper/sfRichTextEditorFCK.class.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/helper/sfRichTextEditorTinyMCE.class.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/plugin/sfPearRestPlugin.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugin/sfPluginManager.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelAdmin/default/template/actions/actions.class.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/addon/sfPropelDatabaseSchema.class.php (modified) (4 diffs)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/form/sfFormPropel.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php (modified) (6 diffs)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/validator/sfPropelUniqueValidator.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/validator/sfValidatorPropelChoice.class.php (modified) (4 diffs)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/validator/sfValidatorPropelUnique.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/validator/sfValidatorPropelUnique.class.php) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/widget/sfWidgetFormPropelSelect.class.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/actions (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/actions)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/actions/actions.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/actions/actions.class.php)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/templates (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/templates)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/templates/articleSuccess.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/templates/articleSuccess.php)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/templates/categorySuccess.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/frontend/modules/unique/templates/categorySuccess.php)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/schema-transformed.xml (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/schema.xml (modified) (2 diffs)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/CategoryPeer.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/functional/formTest.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/unit/fixtures/new_schema.yml (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/unit/fixtures/schema.xml (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/unit/fixtures/schema.yml (modified) (1 diff)
- branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/test/unit/sfPropelDatabaseSchemaTest.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/request/sfRequest.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/request/sfWebRequest.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/routing/sfPatternRouting.class.php (modified) (4 diffs)
- branches/dwhittle/1.1/lib/routing/sfRouting.class.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/task/plugin/sfPluginInstallTask.class.php (modified) (2 diffs)
- branches/dwhittle/1.1/lib/task/project/sfProjectFreezeTask.class.php (modified) (1 diff)
- branches/dwhittle/1.1/test/bin/loc.php (modified) (2 diffs)
- branches/dwhittle/1.1/test/unit/helper/FormHelperTest.php (modified) (2 diffs)
- branches/dwhittle/1.1/test/unit/helper/UrlHelperTest.php (modified) (2 diffs)
- branches/dwhittle/1.1/test/unit/request/sfRequestTest.php (modified) (2 diffs)
- branches/dwhittle/1.1/test/unit/routing/sfPatternRoutingTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/1.0/lib/helper/JavascriptHelper.php
r8723 r8851 266 266 $options['form'] = true; 267 267 268 $options_html['onsubmit'] = remote_function($options).' ;return false;';268 $options_html['onsubmit'] = remote_function($options).' return false;'; 269 269 $options_html['action'] = isset($options_html['action']) ? $options_html['action'] : url_for($options['url']); 270 270 $options_html['method'] = isset($options_html['method']) ? $options_html['method'] : 'post'; … … 288 288 289 289 $options_html['type'] = 'button'; 290 $options_html['onclick'] = remote_function($options).' ;return false;';290 $options_html['onclick'] = remote_function($options).' return false;'; 291 291 $options_html['name'] = $name; 292 292 $options_html['value'] = $value; … … 447 447 } 448 448 449 return $function ;449 return $function.';'; 450 450 } 451 451 branches/dwhittle/1.0/lib/helper/ObjectAdminHelper.php
r6598 r8851 1 1 <?php 2 2 3 use_helper('Form', 'Javascript', 'Helper' );3 use_helper('Form', 'Javascript', 'Helper', 'I18N'); 4 4 5 5 /* branches/dwhittle/1.0/lib/helper/UrlHelper.php
r8007 r8851 239 239 * @see url_for, link_to 240 240 */ 241 function button_to($name, $internal_uri , $options = array())242 { 243 $html_options = _ convert_options($options);241 function button_to($name, $internal_uri ='', $options = array()) 242 { 243 $html_options = _parse_attributes($options); 244 244 $html_options['value'] = $name; 245 245 … … 256 256 return form_tag($internal_uri, array('method' => 'post', 'class' => 'button_to')).content_tag('div', tag('input', $html_options)).'</form>'; 257 257 } 258 else if (isset($html_options['popup'])) 259 { 260 $html_options['type'] = 'button'; 261 $html_options = _convert_options_to_javascript($html_options, $internal_uri); 262 263 return tag('input', $html_options); 258 259 $url = url_for($internal_uri); 260 if (isset($html_options['query_string'])) 261 { 262 $url = $url.'?'.$html_options['query_string']; 263 unset($html_options['query_string']); 264 } 265 $url = "'".$url."'"; 266 $html_options['type'] = 'button'; 267 268 if (isset($html_options['popup'])) 269 { 270 $html_options = _convert_options_to_javascript($html_options, $url); 271 unset($html_options['popup']); 264 272 } 265 273 else 266 274 { 267 $html_options['type'] = 'button'; 268 $html_options['onclick'] = "document.location.href='".url_for($internal_uri)."';"; 275 $html_options['onclick'] = "document.location.href=".$url.";"; 269 276 $html_options = _convert_options_to_javascript($html_options); 270 271 return tag('input', $html_options); 272 }277 } 278 279 return tag('input', $html_options); 273 280 } 274 281 … … 333 340 } 334 341 335 function _convert_options_to_javascript($html_options, $ internal_uri = '')342 function _convert_options_to_javascript($html_options, $url = 'this.href') 336 343 { 337 344 // confirm … … 355 362 else if ($confirm && $popup) 356 363 { 357 $html_options['onclick'] = $onclick.'if ('._confirm_javascript_function($confirm).') { '._popup_javascript_function($popup, $ internal_uri).' };return false;';364 $html_options['onclick'] = $onclick.'if ('._confirm_javascript_function($confirm).') { '._popup_javascript_function($popup, $url).' };return false;'; 358 365 } 359 366 else if ($confirm && $post) … … 378 385 else if ($popup) 379 386 { 380 $html_options['onclick'] = $onclick._popup_javascript_function($popup, $ internal_uri).'return false;';387 $html_options['onclick'] = $onclick._popup_javascript_function($popup, $url).'return false;'; 381 388 } 382 389 … … 389 396 } 390 397 391 function _popup_javascript_function($popup, $internal_uri = '') 392 { 393 $url = $internal_uri == '' ? 'this.href' : "'".url_for($internal_uri)."'"; 394 398 function _popup_javascript_function($popup, $url = '') 399 { 395 400 if (is_array($popup)) 396 401 { branches/dwhittle/1.0/lib/helper/sfRichTextEditorFCK.class.php
r6598 r8851 87 87 $content = $fckeditor->CreateHtml(); 88 88 89 //fix for http://trac.symfony-project.com/ticket/732 90 //fields need to be of type text to be picked up by fillin. they are hidden by inline css anyway: 91 //<input type="hidden" id="name" name="name" style="display:none" value="<p>default</p>"> 92 $content = str_replace('type="hidden"','type="text"',$content); 93 89 94 return $content; 90 95 } branches/dwhittle/1.0/lib/helper/sfRichTextEditorTinyMCE.class.php
r6598 r8851 42 42 // we need to know the id for things the rich text editor 43 43 // in advance of building the tag 44 $id = _get_option($options, 'id', $this->name);44 $id = _get_option($options, 'id', get_id_from_name($this->name, null)); 45 45 46 46 // use tinymce's gzipped js? … … 110 110 return 111 111 content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')). 112 content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => get_id_from_name($id, null)), _convert_options($options)));112 content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => $id), _convert_options($options))); 113 113 } 114 114 } branches/dwhittle/1.0/lib/request/sfWebRequest.class.php
r8486 r8851 758 758 759 759 /** 760 * Returns true id the request is a XMLHttpRequest (via prototype 'HTTP_X_REQUESTED_WITH' header). 761 * 762 * @return boolean 760 * Returns true if the request is a XMLHttpRequest. 761 * 762 * It works if your JavaScript library set an X-Requested-With HTTP header. 763 * Works with Prototype, Mootools, jQuery, and perhaps others. 764 * 765 * @return Boolean true if the request is an XMLHttpRequest, false otherwise 763 766 */ 764 767 public function isXmlHttpRequest() branches/dwhittle/1.0/test/unit/helper/FormHelperTest.php
r6598 r8851 94 94 } 95 95 96 $t = new lime_test(8 5, new lime_output_color());96 $t = new lime_test(87, new lime_output_color()); 97 97 98 98 $context = sfContext::getInstance(); … … 203 203 $t->like(textarea_tag('name', 'content', array('rich' => 'TinyMCE')), '/tinyMCE\.init/', 'textarea_tag() can create a rich textarea tag based on tinyMCE'); 204 204 $t->like(textarea_tag('name', 'content', array('rich' => true)), '/tinyMCE\.init/', 'textarea_tag() can create a rich textarea tag based on tinyMCE'); 205 //regression for http://trac.symfony-project.com/ticket/3474 206 $t->like(textarea_tag('name[]', 'content', array('rich' => true)), '/elements: "name",/', 'textarea_tag() can create a rich textarea tag based on tinyMCE using correct id'); 207 $t->like(textarea_tag('name[]', 'content', array('rich' => true, 'id' => 'test')), '/elements: "test",/', 'textarea_tag() can create a rich textarea tag based on tinyMCE using correct id'); 205 208 206 209 class sfRichTextEditorSample extends sfRichTextEditor branches/dwhittle/1.0/test/unit/helper/UrlHelperTest.php
r7809 r8851 43 43 } 44 44 45 $t = new lime_test( 26, new lime_output_color());45 $t = new lime_test(32, new lime_output_color()); 46 46 47 47 $context = sfContext::getInstance(); … … 61 61 $t->is(link_to('test', '', array('query_string' => 'foo=bar')), '<a href="module/action?foo=bar">test</a>', 'link_to() can take an "query_string" option'); 62 62 $t->is(link_to(''), '<a href="module/action">module/action</a>', 'link_to() takes the url as the link name if the first argument is empty'); 63 64 //button_to() 65 $t->diag('button_to()'); 66 $t->is(button_to('test'), '<input value="test" type="button" onclick="document.location.href=\'module/action\';" />', 'button_to() returns an HTML "input" tag'); 67 $t->is(button_to('test','', array('query_string' => 'foo=bar')), '<input value="test" type="button" onclick="document.location.href=\'module/action?foo=bar\';" />', 'button_to() returns an HTML "input" tag'); 68 $t->is(button_to('test','', array('popup' => 'true', 'query_string' => 'foo=bar')), '<input value="test" type="button" onclick="var w=window.open(\'module/action?foo=bar\');w.focus();return false;" />', 'button_to() returns an HTML "input" tag'); 69 $t->is(button_to('test','', 'popup=true'), '<input value="test" type="button" onclick="var w=window.open(\'module/action\');w.focus();return false;" />', 'button_to() accepts options as string'); 70 $t->is(button_to('test','', 'confirm=really?'), '<input value="test" type="button" onclick="if (confirm(\'really?\')) { return document.location.href=\'module/action\';} else return false;" />', 'button_to() works with confirm option'); 71 $t->is(button_to('test','', 'popup=true confirm=really?'), '<input value="test" type="button" onclick="if (confirm(\'really?\')) { var w=window.open(\'module/action\');w.focus(); };return false;" />', 'button_to() works with confirm and popup option'); 72 63 73 class testObject 64 74 { branches/dwhittle/1.1/lib/cache/sfAPCCache.class.php
r6419 r8851 30 30 public function initialize($options = array()) 31 31 { 32 parent::initialize($options);33 34 32 if (!function_exists('apc_store') || !ini_get('apc.enabled')) 35 33 { 36 34 throw new sfInitializationException('You must have APC installed and enabled to use sfAPCCache class.'); 37 35 } 36 37 parent::initialize($options); 38 38 } 39 39 branches/dwhittle/1.1/lib/cache/sfMemcacheCache.class.php
r6419 r8851 41 41 public function initialize($options = array()) 42 42 { 43 if (!class_exists('Memcache')) 44 { 45 throw new sfInitializationException('You must have memcache installed and enabled to use sfMemcacheCache class.'); 46 } 47 43 48 parent::initialize($options); 44 45 if (!class_exists('Memcache'))46 {47 throw new sfInitializationException('You must have memcache installed and enabled to use sfMemcacheCache class.');48 }49 49 50 50 if ($this->getOption('memcache')) branches/dwhittle/1.1/lib/cache/sfXCacheCache.class.php
r6258 r8851 26 26 * Available parameters: 27 27 * 28 * * see sfCache for default parameters available for all drivers28 * * see sfCache for default options available for all drivers 29 29 * 30 30 * @see sfCache 31 31 */ 32 public function initialize($ parameters = array())32 public function initialize($options = array()) 33 33 { 34 parent::initialize($parameters);35 36 34 if (!function_exists('xcache_set')) 37 35 { … … 39 37 } 40 38 41 $this->prefix = md5($this->getParameter('prefix', sfConfig::get('sf_app'))).self::SEPARATOR; 39 if (!ini_get('xcache.var_size')) 40 { 41 throw new sfInitializationException('You must set the "xcache.var_size" variable to a value greater than 0 to use sfXCacheCache class.'); 42 } 43 44 parent::initialize($options); 42 45 } 43 46 branches/dwhittle/1.1/lib/helper/FormHelper.php
r7775 r8851 231 231 232 232 $option_tags = options_for_select($countries, $selected, $options); 233 234 233 unset($options['include_blank'], $options['include_custom']); 235 234 … … 280 279 281 280 $option_tags = options_for_select($languages, $selected, $options); 282 283 281 unset($options['include_blank'], $options['include_custom']); 284 282 … … 669 667 $jss = array( 670 668 sfConfig::get('sf_calendar_web_dir').'/calendar', 671 sfConfig::get('sf_calendar_web_dir').'/lang/calendar-en', 672 $langFile, 669 is_readable(sfConfig::get('sf_symfony_data_dir').'/web/'.$langFile.'.js') || is_readable(sfConfig::get('sf_web_dir').'/'.$langFile.'.js') ? $langFile : sfConfig::get('sf_calendar_web_dir').'/lang/calendar-en', 673 670 sfConfig::get('sf_calendar_web_dir').'/calendar-setup', 674 671 ); branches/dwhittle/1.1/lib/helper/JavascriptHelper.php
r8723 r8851 273 273 $options_html = _parse_attributes($options_html); 274 274 275 275 276 $options['form'] = true; 276 277 277 $options_html['onsubmit'] = remote_function($options).' ;return false;';278 $options_html['onsubmit'] = remote_function($options).' return false;'; 278 279 $options_html['action'] = isset($options_html['action']) ? $options_html['action'] : url_for($options['url']); 279 280 $options_html['method'] = isset($options_html['method']) ? $options_html['method'] : 'post'; … … 297 298 298 299 $options_html['type'] = 'button'; 299 $options_html['onclick'] = remote_function($options).' ;return false;';300 $options_html['onclick'] = remote_function($options).' return false;'; 300 301 $options_html['name'] = $name; 301 302 $options_html['value'] = $value; … … 319 320 320 321 $options_html['type'] = 'image'; 321 $options_html['onclick'] = remote_function($options).' ;return false;';322 $options_html['onclick'] = remote_function($options).' return false;'; 322 323 $options_html['name'] = $name; 323 324 $options_html['src'] = image_path($source); … … 512 513 } 513 514 514 return $function ;515 return $function.';'; 515 516 } 516 517 … … 952 953 { 953 954 $javascript = "new Ajax.Autocompleter("; 954 if (isset($options['param_name'])) 955 if (isset($options['param_name'])) 955 956 { 956 957 $js_options['paramName'] = "'".$options['param_name']."'"; branches/dwhittle/1.1/lib/helper/ObjectAdminHelper.php
r8800 r8851 1 1 <?php 2 2 3 use_helper('Form', 'Javascript', 'Helper' );3 use_helper('Form', 'Javascript', 'Helper', 'I18N'); 4 4 5 5 /* … … 42 42 if ($include_remove = _get_option($options, 'include_remove')) 43 43 { 44 $html .= checkbox_tag(strpos($name, ']') !== false ? substr($name, 0, -1).'_remove]' : $name).' '.($include_remove != true ? __($include_remove) : __('remove file'))."\n";44 $html .= checkbox_tag(strpos($name, ']') !== false ? substr($name, 0, -1).'_remove]' : $name).' '.($include_remove !== true ? __($include_remove) : __('remove file'))."\n"; 45 45 } 46 46 } branches/dwhittle/1.1/lib/helper/UrlHelper.php
r8467 r8851 67 67 * echo link_to('Delete this page', 'my_module/my_action'); 68 68 * => <a href="/path/to/my/action">Delete this page</a> 69 * echo link_to('Visit Hoogle', 'http://www.hoogle.com');70 * => <a href="http://www. hoogle.com">Visit Hoogle</a>69 * echo link_to('Visit google', 'http://www.google.com'); 70 * => <a href="http://www.google.com">Visit google</a> 71 71 * echo link_to('Delete this page', 'my_module/my_action', array('id' => 'myid', 'confirm' => 'Are you sure?', 'absolute' => true)); 72 72 * => <a href="http://myapp.example.com/path/to/my/action" id="myid" onclick="return confirm('Are you sure?');">Delete this page</a> … … 232 232 * @see url_for, link_to 233 233 */ 234 function button_to($name, $internal_uri, $options = array()) 235 { 236 $html_options = _convert_options($options); 234 function button_to($name, $internal_uri ='', $options = array()) 235 { 236 $html_options = _parse_attributes($options); 237 237 238 $html_options['value'] = $name; 238 239 … … 271 272 return form_tag($internal_uri, array('method' => 'post', 'class' => 'button_to')).content_tag('div', tag('input', $html_options)).'</form>'; 272 273 } 273 else if (isset($html_options['popup'])) 274 { 275 $html_options['type'] = 'button'; 276 $html_options = _convert_options_to_javascript($html_options, $internal_uri, $absolute); 277 278 return tag('input', $html_options); 274 275 $url = url_for($internal_uri, $absolute); 276 $url = "'".$url.$query_string."'"; 277 278 $html_options['type'] = 'button'; 279 if (isset($html_options['popup'])) 280 { 281 $html_options = _convert_options_to_javascript($html_options, $url); 282 unset($html_options['popup']); 279 283 } 280 284 else 281 285 { 282 $html_options['type'] = 'button'; 283 $html_options['onclick'] = "document.location.href='".url_for($internal_uri, $absolute).$query_string."';"; 286 $html_options['onclick'] = "document.location.href=".$url.";"; 284 287 $html_options = _convert_options_to_javascript($html_options); 285 286 return tag('input', $html_options); 287 }288 } 289 290 return tag('input', $html_options); 288 291 } 289 292 … … 348 351 } 349 352 350 function _convert_options_to_javascript($html_options, $ internal_uri = '', $absolute = false)353 function _convert_options_to_javascript($html_options, $url = 'this.href') 351 354 { 352 355 // confirm … … 370 373 else if ($confirm && $popup) 371 374 { 372 $html_options['onclick'] = $onclick.'if ('._confirm_javascript_function($confirm).') { '._popup_javascript_function($popup, $ internal_uri, $absolute).' };return false;';375 $html_options['onclick'] = $onclick.'if ('._confirm_javascript_function($confirm).') { '._popup_javascript_function($popup, $url).' };return false;'; 373 376 } 374 377 else if ($confirm && $post) … … 393 396 else if ($popup) 394 397 { 395 $html_options['onclick'] = $onclick._popup_javascript_function($popup, $ internal_uri, $absolute).'return false;';398 $html_options['onclick'] = $onclick._popup_javascript_function($popup, $url).'return false;'; 396 399 } 397 400 … … 404 407 } 405 408 406 function _popup_javascript_function($popup, $internal_uri = '', $absolute = false) 407 { 408 $url = $internal_uri == '' ? 'this.href' : "'".url_for($internal_uri, $absolute)."'"; 409 409 410 function _popup_javascript_function($popup, $url = '') 411 { 410 412 if (is_array($popup)) 411 413 { branches/dwhittle/1.1/lib/helper/sfRichTextEditorFCK.class.php
r7772 r8851 4 4 * This file is part of the symfony package. 5 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 87 87 $content = $fckeditor->CreateHtml(); 88 88 89 //fix for http://trac.symfony-project.com/ticket/732 90 //fields need to be of type text to be picked up by fillin. they are hidden by inline css anyway: 91 //<input type="hidden" id="name" name="name" style="display:none" value="<p>default</p>"> 92 $content = str_replace('type="hidden"','type="text"', $content); 93 89 94 return $content; 90 95 } branches/dwhittle/1.1/lib/helper/sfRichTextEditorTinyMCE.class.php
r7772 r8851 42 42 // we need to know the id for things the rich text editor 43 43 // in advance of building the tag 44 $id = _get_option($options, 'id', $this->name);44 $id = _get_option($options, 'id', get_id_from_name($this->name, null)); 45 45 46 46 // use tinymce's gzipped js? … … 110 110 return 111 111 content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')). 112 content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => get_id_from_name($id, null)), _convert_options($options)));112 content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => $id), _convert_options($options))); 113 113 } 114 114 } branches/dwhittle/1.1/lib/plugin/sfPearRestPlugin.class.php
r5257 r8851 73 73 74 74 /** 75 * Returns the license for a given plugin and version. 76 * 77 * @param string The plugin name 78 * @param string The version 79 * 80 * @param string The license 81 */ 82 public function getPluginLicense($plugin, $version) 83 { 84 $info = $this->packageInfo($this->restBase, $plugin); 85 86 if (is_null($info)) 87 { 88 // plugin does not exist 89 return null; 90 } 91 92 if (!isset($info['license']) || is_null($info['license'])) 93 { 94 throw new Exception('No license found for this plugin!'); 95 } 96 97 return $info['releases'][$version]['license']; 98 } 99 100 /** 75 101 * Gets the all available versions for a given plugin. 76 102 * branches/dwhittle/1.1/lib/plugin/sfPluginManager.class.php
r7671 r8851 413 413 414 414 /** 415 * Returns the license for a given plugin. 416 * 417 * @param string The plugin name 418 * @param array An array of options 419 * 420 * @param string The license 421 * 422 * @see installPlugin() for available options 423 */ 424 public function getPluginLicense($plugin, $options = array()) 425 { 426 $channel = isset($options['channel']) ? $options['channel'] : $this->environment->getConfig()->get('default_channel'); 427 $stability = isset($options['stability']) ? $options['stability'] : $this->environment->getConfig()->get('preferred_state', null, $channel); 428 $version = isset($options['version']) ? $options['version'] : null; 429 430 $rest = $this->environment->getRest(); 431 $rest->setChannel(is_null($channel) ? $this->environment->getConfig()->get('default_channel') : $channel); 432 433 if (is_null($version)) 434 { 435 $version = $this->getPluginVersion($plugin, $stability); 436 } 437 438 return $rest->getPluginLicense($plugin, $version); 439 } 440 441 /** 415 442 * Returns true if the plugin is comptatible with the dependency. 416 443 * branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelAdmin/default/template/actions/actions.class.php
r8315 r8851 91 91 try 92 92 { 93 <?php echo $this->getClassName() ?>Peer::doDelete($this->selectedItems); 93 foreach (<?php echo $this->getClassName() ?>Peer::retrieveByPks($this->selectedItems) as $object) 94 { 95 $object->delete(); 96 } 94 97 } 95 98 catch (PropelException $e) … … 468 471 if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort')) 469 472 { 470 471 $sort_column = sfInflector::camelize(strtolower($sort_column));472 $sort_column = <?php echo $this->getClassName() ?>Peer::translateFieldName($sort_column, BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); 473 // camelize lower case to be able to compare with BasePeer::TYPE_PHPNAME translate field name 474 $sort_column = <?php echo $this->getClassName() ?>Peer::translateFieldName(sfInflector::camelize(strtolower($sort_column)), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); 475 473 476 if ($this->getUser()->getAttribute('type', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == 'asc') 474 477 { branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php
r8511 r8851 33 33 )); 34 34 35 <?php if ($uniqueColumns = $this->getUniqueColumnNames()): ?> 36 $this->validatorSchema->setPostValidator( 37 <?php if (count($uniqueColumns) > 1): ?> 38 new sfValidatorAnd(array( 39 <?php foreach ($uniqueColumns as $uniqueColumn): ?> 40 new sfValidatorPropelUnique(array('model' => '<?php echo $this->table->getPhpName() ?>', 'column' => array('<?php echo strtolower(implode("', '", $uniqueColumn)) ?>'))), 41 <?php endforeach; ?> 42 )) 43 <?php else: ?> 44 new sfValidatorPropelUnique(array('model' => '<?php echo $this->table->getPhpName() ?>', 'column' => array('<?php echo strtolower(implode("', '", $uniqueColumns[0])) ?>'))) 45 <?php endif; ?> 46 ); 47 48 <?php endif; ?> 35 49 $this->widgetSchema->setNameFormat('<?php echo $this->underscore($this->table->getPhpName()) ?>[%s]'); 36 50 branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/addon/sfPropelDatabaseSchema.class.php
r8630 r8851 148 148 $classes[$phpName]['behaviors'] = $column_params; 149 149 break; 150 case '_inheritance': 151 $classes[$phpName]['inheritance'] = $column_params; 152 break; 150 153 case '_foreignKeys': 151 154 $classes[$phpName]['foreignKeys'] = $column_params; … … 233 236 } 234 237 238 // Inheritance 239 if (isset($classParams['inheritance'])) 240 { 241 $tableParams['_inheritance'] = $classParams['inheritance']; 242 unset($classParams['inheritance']); 243 } 244 235 245 // Table attributes 236 246 $tableAttributes = array(); … … 294 304 foreach ($this->getChildren($table) as $col_name => $column) 295 305 { 306 // inheritance 307 if (isset($table['_inheritance']) && 308 isset($table['_inheritance']['column']) && 309 $col_name == $table['_inheritance']['column'] && 310 isset($table['_inheritance']['classes']) && 311 is_array($table['_inheritance']['classes'])) 312 { 313 $column['inheritance'] = $table['_inheritance']['classes']; 314 unset($table['_inheritance']); 315 } 316 296 317 $xml .= " <column name=\"$col_name\"".$this->getAttributesForColumn($tb_name, $col_name, $column); 297 318 } … … 612 633 foreach ($column as $key => $value) 613 634 { 614 if (!in_array($key, array('foreignClass', 'foreignTable', 'foreignReference', 'onDelete', 'onUpdate', 'index', 'unique', 'sequence' )))635 if (!in_array($key, array('foreignClass', 'foreignTable', 'foreignReference', 'onDelete', 'onUpdate', 'index', 'unique', 'sequence', 'inheritance'))) 615 636 { 616 637 $attributes_string .= " $key=\"".htmlspecialchars($this->getCorrectValueFor($key, $value), ENT_QUOTES, sfConfig::get('sf_charset'))."\""; 617 638 } 618 639 } 619 $attributes_string .= " />\n"; 640 if (isset($column['inheritance'])) 641 { 642 $attributes_string .= ' inheritance="single">'."\n"; 643 644 $extended_package = isset($this->database[$tb_name]['_attributes']['package']) ? 645 $this->database[$tb_name]['_attributes']['package'] : 646 $this->database['_attributes']['package']; 647 $extended_class = $this->database[$tb_name]['_attributes']['phpName']; 648 649 foreach ($column['inheritance'] as $key => $class) 650 { 651 $attributes_string .= sprintf(' <inheritance extends="%s.%s" key="%s" class="%s" />%s', 652 $extended_package, $extended_class, $key, $class, "\n"); 653 } 654 $attributes_string .= ' </column>'."\n"; 655 } 656 else 657 { 658 $attributes_string .= " />\n"; 659 } 620 660 } 621 661 else branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php
r7497 r8851 56 56 $this->addI18nMethods($script); 57 57 } 58 59 $this->addUniqueColumnNamesMethod($script); 58 60 } 59 61 … … 411 413 } 412 414 } 415 416 protected function addUniqueColumnNamesMethod(&$script) 417 { 418 $unices = array(); 419 foreach ($this->getTable()->getUnices() as $unique) 420 { 421 $unices[] = sprintf("array('%s')", implode("', '", $unique->getColumns())); 422 } 423 424 $unices = implode(', ', $unices); 425 $script .= <<<EOF 426 427 428 static public function getUniqueColumnNames() 429 { 430 return array($unices); 431 } 432 EOF; 433 } 413 434 } branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/form/sfFormPropel.class.php
r7853 r8851 65 65 { 66 66 return Propel::getConnection(constant(sprintf('%s::DATABASE_NAME', get_class($this->object->getPeer())))); 67 return Propel::getConnection(constant(sprintf('%s::DATABASE_NAME', get_class($this->object->getPeer()))));68 67 } 69 68 branches/dwhittle/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
r8800 r8851 15 15 * 16 16 * @package symfony 17 * @subpackage propel17 * @subpackage generator 18 18 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 19 19 * @version SVN: $Id$ … … 67 67 68 68 // create the project base class for all forms 69 $file = sfConfig::get('sf_lib_dir'). DIRECTORY_SEPARATOR.'form'.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR.'BaseFormPropel.class.php';69 $file = sfConfig::get('sf_lib_dir').'/form/base/BaseFormPropel.class.php'; 70 70 if (!file_exists($file)) 71 71 { 72 if (!is_dir(sfConfig::get('sf_lib_dir'). DIRECTORY_SEPARATOR.'form'.DIRECTORY_SEPARATOR.'base'))73 { 74 mkdir(sfConfig::get('sf_lib_dir'). DIRECTORY_SEPARATOR.'form'.DIRECTORY_SEPARATOR.'base', 0777, true);