Changeset 1464
- Timestamp:
- 06/16/06 16:30:25 (2 years ago)
- Files:
-
- branches/slickrick/data/tasks/sfPakeGenerator.php (modified) (1 diff)
- branches/slickrick/data/web/sf/js/calendar/lang/calendar-no.js (modified) (3 diffs)
- branches/slickrick/lib/config/sfViewConfigHandler.class.php (modified) (5 diffs)
- branches/slickrick/lib/debug/sfWebDebug.class.php (modified) (9 diffs)
- branches/slickrick/lib/filter/sfExecutionFilter.class.php (modified) (1 diff)
- branches/slickrick/lib/filter/sfWebDebugFilter.class.php (modified) (1 diff)
- branches/slickrick/lib/generator/sfGenerator.class.php (modified) (2 diffs)
- branches/slickrick/lib/generator/sfPropelAdminGenerator.class.php (modified) (2 diffs)
- branches/slickrick/lib/generator/sfPropelCrudGenerator.class.php (modified) (1 diff)
- branches/slickrick/lib/helper/DebugHelper.php (modified) (1 diff)
- branches/slickrick/lib/helper/FormHelper.php (modified) (1 diff)
- branches/slickrick/lib/vendor/propel/util/BasePeer.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/slickrick/data/tasks/sfPakeGenerator.php
r1450 r1464 106 106 $sf_root_dir = sfConfig::get('sf_root_dir'); 107 107 108 if (is_readable(sfConfig::get('sf_data_dir').'/skeleton/module')) 109 { 110 $sf_skeleton_dir = sfConfig::get('sf_data_dir').'/skeleton/module'; 111 } 112 else 113 { 114 $sf_skeleton_dir = sfConfig::get('sf_symfony_data_dir').'/skeleton/module'; 115 } 116 108 117 // create basic application structure 109 118 $finder = pakeFinder::type('any')->prune('.svn')->discard('.svn', '.sf'); 110 pake_mirror($finder, sfConfig::get('sf_symfony_data_dir').'/skeleton/module/module/', $sf_root_dir.'/'.sfConfig::get('sf_apps_dir_name').'/'.$app.'/'.sfConfig::get('sf_app_module_dir_name').'/'.$module);119 pake_mirror($finder, $sf_skeleton_dir.'/module/', $sf_root_dir.'/'.sfConfig::get('sf_apps_dir_name').'/'.$app.'/'.sfConfig::get('sf_app_module_dir_name').'/'.$module); 111 120 112 121 // create basic test 113 pake_copy( sfConfig::get('sf_symfony_data_dir').'/skeleton/module/test/actionsTest.php', $sf_root_dir.'/test/'.$app.'/'.$module.'ActionsTest.php');122 pake_copy($sf_skeleton_dir.'/test/actionsTest.php', $sf_root_dir.'/test/'.$app.'/'.$module.'ActionsTest.php'); 114 123 115 124 // customize test file branches/slickrick/data/web/sf/js/calendar/lang/calendar-no.js
r500 r1464 43 43 "Lør", 44 44 "Søn"); 45 46 // First day of the week. "0" means display Sunday first, "1" means display 47 // Monday first, etc. 48 Calendar._FD = 0; 45 49 46 50 // full month names … … 104 108 Calendar._TT["MON_FIRST"] = "Vis mandag først"; 105 109 Calendar._TT["SUN_FIRST"] = "Vis søndag først"; 110 111 // the following is to inform that "%s" is to be the first day of week 112 // %s will be replaced with the day name. 113 Calendar._TT["DAY_FIRST"] = "Vis %s først"; 114 115 // This may be locale-dependent. It specifies the week-end days, as an array 116 // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 117 // means Monday, etc. 118 Calendar._TT["WEEKEND"] = "0"; 119 106 120 Calendar._TT["CLOSE"] = "Lukk"; 107 121 Calendar._TT["TODAY"] = "Idag"; … … 113 127 114 128 Calendar._TT["WK"] = "uke"; 129 Calendar._TT["TIME"] = "Tid:"; branches/slickrick/lib/config/sfViewConfigHandler.class.php
r1450 r1464 226 226 foreach ($this->mergeConfigValue('http_metas', $viewName) as $httpequiv => $content) 227 227 { 228 $data[] = sprintf(" \$response->addHttpMeta('%s', '%s', false);", $httpequiv, $content);228 $data[] = sprintf(" \$response->addHttpMeta('%s', '%s', false);", $httpequiv, str_replace('\'', '\\\'', $content)); 229 229 } 230 230 231 231 foreach ($this->mergeConfigValue('metas', $viewName) as $name => $content) 232 232 { 233 $data[] = sprintf(" \$response->addMeta('%s', '%s', false);", $name, $content);233 $data[] = sprintf(" \$response->addMeta('%s', '%s', false);", $name, str_replace('\'', '\\\'', $content)); 234 234 } 235 235 … … 243 243 $delete = array(); 244 244 $delete_all = false; 245 245 246 246 // Populate $stylesheets with the values from ONLY the current view 247 247 $stylesheets = $this->getConfigValue('stylesheets', $viewName); 248 248 249 249 // If we find results from the view, check to see if there is a '-*' 250 250 // This indicates that we will remove ALL stylesheets EXCEPT for those passed in the current view 251 if (is_array($stylesheets) AND in_array('-*', $stylesheets)) 252 { 253 $delete_all = true; 254 foreach ($stylesheets as $stylesheet) 255 { 256 $key = is_array($stylesheet) ? key($stylesheet) : $stylesheet; 257 258 if ($key != '-*') 259 { 260 $omit[] = $key; 261 } 262 } 263 } 264 265 // If '-*' is not found and there are items in the current view's stylesheet array 266 // loop through each one and see if there are any values that start with '-'. 267 // If so, we add store the actual stylesheet name to the $delete array to be used below 268 else 269 { 270 foreach ($stylesheets as $stylesheet) 271 { 272 if (!is_array($stylesheet)) 273 { 274 if (substr($stylesheet, 0, 1) == '-') 275 { 276 $delete[] = substr($stylesheet, 1); 277 } 278 } 279 } 280 } 251 if (is_array($stylesheets) AND in_array('-*', $stylesheets)) 252 { 253 $delete_all = true; 254 foreach ($stylesheets as $stylesheet) 255 { 256 $key = is_array($stylesheet) ? key($stylesheet) : $stylesheet; 257 258 if ($key != '-*') 259 { 260 $omit[] = $key; 261 } 262 } 263 } 264 else 265 { 266 // If '-*' is not found and there are items in the current view's stylesheet array 267 // loop through each one and see if there are any values that start with '-'. 268 // If so, we add store the actual stylesheet name to the $delete array to be used below 269 foreach ($stylesheets as $stylesheet) 270 { 271 if (!is_array($stylesheet)) 272 { 273 if (substr($stylesheet, 0, 1) == '-') 274 { 275 $delete[] = substr($stylesheet, 1); 276 } 277 } 278 } 279 } 281 280 282 281 // Merge the current view's stylesheets with the app's default stylesheets 283 282 $stylesheets = $this->mergeConfigValue('stylesheets', $viewName); 284 283 if (is_array($stylesheets)) 285 { 286 // Loop through each stylesheet in the merged array 284 { 285 // Loop through each stylesheet in the merged array 287 286 foreach ($stylesheets as $index => $stylesheet) 288 287 { 289 288 $key = is_array($stylesheet) ? key($stylesheet) : $stylesheet; 290 289 291 290 // If $delete_all is true, a '-*' was found above. 292 291 // We remove all stylesheets from the array EXCEPT those specified in the $omit array 293 292 if ($delete_all == true) 294 293 { 295 if (!in_array($key, $omit))296 {297 unset($stylesheets[$index]);298 }294 if (!in_array($key, $omit)) 295 { 296 unset($stylesheets[$index]); 297 } 299 298 } 300 299 else … … 306 305 if ($key == $value OR substr($key, 1) == $value) 307 306 { 308 unset($stylesheets[$index]);307 unset($stylesheets[$index]); 309 308 } 310 309 } … … 338 337 } 339 338 340 341 339 $omit = array(); 342 340 $delete_all = false; 343 341 344 342 // Populate $javascripts with the values from ONLY the current view 345 343 $javascripts = $this->getConfigValue('javascripts', $viewName); 346 344 347 345 // If we find results from the view, check to see if there is a '-*' 348 346 // This indicates that we will remove ALL javascripts EXCEPT for those passed in the current view 349 if (is_array($javascripts) AND in_array('-*', $javascripts))350 {351 $delete_all = true;352 foreach ($javascripts as $javascript)353 { 354 if (substr($javascript, 0, 1) != '-')355 {356 $omit[] = $javascript;357 }358 }359 } 360 347 if (is_array($javascripts) AND in_array('-*', $javascripts)) 348 { 349 $delete_all = true; 350 foreach ($javascripts as $javascript) 351 { 352 if (substr($javascript, 0, 1) != '-') 353 { 354 $omit[] = $javascript; 355 } 356 } 357 } 358 361 359 $javascripts = $this->mergeConfigValue('javascripts', $viewName); 362 360 if (is_array($javascripts)) … … 365 363 // We exclude any javascripts that were omitted above 366 364 $delete = array(); 367 365 368 366 foreach ($javascripts as $javascript) 369 367 { branches/slickrick/lib/debug/sfWebDebug.class.php
r1450 r1464 236 236 { 237 237 $self_url = $_SERVER['PHP_SELF'].((strpos($_SERVER['PHP_SELF'], 'sf_ignore_cache') === false) ? '?sf_ignore_cache=1' : ''); 238 $cacheLink = '<a href="'.$self_url.'" title="reload and ignore cache"><img src="'.$this->base_image_path.'/reload.png" /></a>';238 $cacheLink = '<a href="'.$self_url.'" title="reload and ignore cache"><img src="'.$this->base_image_path.'/reload.png" alt=""/></a>'; 239 239 } 240 240 … … 243 243 if (sfConfig::get('sf_logging_active')) 244 244 { 245 $logLink = '<li><a href="#" onclick="document.getElementById(\'sfWebDebugConfig\').style.display=\'none\';document.getElementById(\'sfWebDebugDatabaseDetails\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugLog\'); return false;"><img src="'.$this->base_image_path.'/comment.png" /> logs & msgs</a></li>';245 $logLink = '<li><a href="#" onclick="document.getElementById(\'sfWebDebugConfig\').style.display=\'none\';document.getElementById(\'sfWebDebugDatabaseDetails\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugLog\'); return false;"><img src="'.$this->base_image_path.'/comment.png" alt=""/> logs & msgs</a></li>'; 246 246 } 247 247 … … 251 251 if (null !== ($nb = $this->getDatabaseRequestNumber())) 252 252 { 253 $dbInfo = '<li><a href="#" onclick="document.getElementById(\'sfWebDebugConfig\').style.display=\'none\';document.getElementById(\'sfWebDebugLog\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugDatabaseDetails\'); return false;"><img src="'.$this->base_image_path.'/database.png" /> '.$nb.'</a></li>';253 $dbInfo = '<li><a href="#" onclick="document.getElementById(\'sfWebDebugConfig\').style.display=\'none\';document.getElementById(\'sfWebDebugLog\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugDatabaseDetails\'); return false;"><img src="'.$this->base_image_path.'/database.png" alt=""/> '.$nb.'</a></li>'; 254 254 255 255 $dbInfoDetails = ' … … 265 265 { 266 266 $total_memory = sprintf('%.1f', (memory_get_usage() / 1024)); 267 $memoryInfo = '<li><img src="'.$this->base_image_path.'/memory.png" /> '.$total_memory.' KB</li>';267 $memoryInfo = '<li><img src="'.$this->base_image_path.'/memory.png" alt=""/> '.$total_memory.' KB</li>'; 268 268 } 269 269 … … 274 274 $total_time = (microtime(true) - sfConfig::get('sf_timer_start')) * 1000; 275 275 $total_time = sprintf(($total_time <= 1) ? '%.2f' : '%.0f', $total_time); 276 $timeInfo = '<li class="last"><img src="'.$this->base_image_path.'/time.png" /> '.$total_time.' ms</li>';276 $timeInfo = '<li class="last"><img src="'.$this->base_image_path.'/time.png" alt="" /> '.$total_time.' ms</li>'; 277 277 } 278 278 … … 292 292 <li><a href="#" onclick="sfWebDebugToggleAllLogLines(true, \'sfWebDebugLogLine\'); return false;">[all]</a></li> 293 293 <li><a href="#" onclick="sfWebDebugToggleAllLogLines(false, \'sfWebDebugLogLine\'); return false;">[none]</a></li> 294 <li><a href="#" onclick="sfWebDebugShowOnlyLogLines(\'info\'); return false;"><img src="'.$this->base_image_path.'/info.png" /></a></li>295 <li><a href="#" onclick="sfWebDebugShowOnlyLogLines(\'warning\'); return false;"><img src="'.$this->base_image_path.'/warning.png" /></a></li>296 <li><a href="#" onclick="sfWebDebugShowOnlyLogLines(\'error\'); return false;"><img src="'.$this->base_image_path.'/error.png" /></a></li>294 <li><a href="#" onclick="sfWebDebugShowOnlyLogLines(\'info\'); return false;"><img src="'.$this->base_image_path.'/info.png" alt="" /></a></li> 295 <li><a href="#" onclick="sfWebDebugShowOnlyLogLines(\'warning\'); return false;"><img src="'.$this->base_image_path.'/warning.png" alt="" /></a></li> 296 <li><a href="#" onclick="sfWebDebugShowOnlyLogLines(\'error\'); return false;"><img src="'.$this->base_image_path.'/error.png" alt="" /></a></li> 297 297 <li>'.implode("</li>\n<li>", $types).'</li> 298 298 </ul> … … 304 304 <div id="sfWebDebug"> 305 305 <div id="sfWebDebugBar" class="sfWebDebug'.ucfirst($max_priority).'"> 306 <a href="#" onclick="sfWebDebugToggleMenu(); return false;"><img src="'.$this->base_image_path.'/sf.png" /></a>306 <a href="#" onclick="sfWebDebugToggleMenu(); return false;"><img src="'.$this->base_image_path.'/sf.png" alt="" /></a> 307 307 <ul id="sfWebDebugDetails" class="menu"> 308 <li><a href="#" onclick="document.getElementById(\'sfWebDebugLog\').style.display=\'none\';document.getElementById(\'sfWebDebugDatabaseDetails\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugConfig\'); return false;"><img src="'.$this->base_image_path.'/config.png" /> vars & config</a></li>308 <li><a href="#" onclick="document.getElementById(\'sfWebDebugLog\').style.display=\'none\';document.getElementById(\'sfWebDebugDatabaseDetails\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugConfig\'); return false;"><img src="'.$this->base_image_path.'/config.png" alt="" /> vars & config</a></li> 309 309 '.$cacheLink.' 310 310 '.$logLink.' … … 313 313 '.$timeInfo.' 314 314 </ul> 315 <a href="#" onclick="document.getElementById(\'sfWebDebug\').style.display=\'none\'; return false;"><img src="'.$this->base_image_path.'/close.png" /></a>315 <a href="#" onclick="document.getElementById(\'sfWebDebug\').style.display=\'none\'; return false;"><img src="'.$this->base_image_path.'/close.png" alt="" /></a> 316 316 </div> 317 317 … … 372 372 $id = ucfirst(strtolower($id)); 373 373 $content = ' 374 <h2>'.$id.' <a href="#" onclick="sfWebDebugToggle(\'sfWebDebug'.$id.'\'); return false;"><img src="'.$this->base_image_path.'/toggle.gif" /></a></h2>375 <div id="sfWebDebug'.$id.'" style="display: none"><pre>'. @sfYaml::Dump($values).'</pre></div>374 <h2>'.$id.' <a href="#" onclick="sfWebDebugToggle(\'sfWebDebug'.$id.'\'); return false;"><img src="'.$this->base_image_path.'/toggle.gif" alt="" /></a></h2> 375 <div id="sfWebDebug'.$id.'" style="display: none"><pre>'.htmlentities(@sfYaml::Dump($values)).'</pre></div> 376 376 '; 377 377 branches/slickrick/lib/filter/sfExecutionFilter.class.php
r1450 r1464 78 78 $validated = true; 79 79 80 // get the current action validation configuration 81 $validationConfig = $moduleName.'/'.sfConfig::get('sf_app_module_validate_dir_name').'/'.$actionName.'.yml'; 82 if (is_readable(sfConfig::get('sf_app_module_dir').'/'.$validationConfig)) 83 { 84 // load validation configuration 85 // do NOT use require_once 86 require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$validationConfig)); 87 } 88 89 // manually load validators 90 $actionInstance->registerValidators($validatorManager); 91 92 // process validators 93 $validated = $validatorManager->execute(); 94 80 95 // process manual validation 81 96 $validateToRun = 'validate'.ucfirst($actionName); 82 $validated = method_exists($actionInstance, $validateToRun) ? $actionInstance->$validateToRun() : $actionInstance->validate(); 83 84 if ($validated) 85 { 86 // get the current action validation configuration 87 $validationConfig = $moduleName.'/'.sfConfig::get('sf_app_module_validate_dir_name').'/'.$actionName.'.yml'; 88 if (is_readable(sfConfig::get('sf_app_module_dir').'/'.$validationConfig)) 89 { 90 // load validation configuration 91 // do NOT use require_once 92 require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$validationConfig)); 93 } 94 95 // manually load validators 96 $actionInstance->registerValidators($validatorManager); 97 98 // process validators 99 $validated = $validatorManager->execute(); 100 } 97 $manualValidated = method_exists($actionInstance, $validateToRun) ? $actionInstance->$validateToRun() : $actionInstance->validate(); 98 99 // action is validated only if both validators returned true 100 $validated = !$context->getRequest()->hasErrors(); 101 101 102 102 $sf_logging_active = sfConfig::get('sf_logging_active'); branches/slickrick/lib/filter/sfWebDebugFilter.class.php
r1450 r1464 56 56 if ( 57 57 $this->getContext()->getRequest()->isXmlHttpRequest() || 58 strpos($response->getContentType(), ' text/html') === false ||58 strpos($response->getContentType(), 'html') === false || 59 59 $response->getStatusCode() == 304 60 60 ) branches/slickrick/lib/generator/sfGenerator.class.php
r1450 r1464 56 56 { 57 57 // eval template file 58 $template_template = $template_dir.'/templates/'.$template .'.php';58 $template_template = $template_dir.'/templates/'.$template; 59 59 if (!is_readable($template_template)) 60 60 { 61 $template_template = $default_template_dir.'/templates/'.$template .'.php';61 $template_template = $default_template_dir.'/templates/'.$template; 62 62 if (!is_readable($template_template)) 63 63 { … … 69 69 70 70 // save actions class 71 $this->getGeneratorManager()->getCache()->set($template .'.php', $generatedModuleName.DIRECTORY_SEPARATOR.'templates', $retval);71 $this->getGeneratorManager()->getCache()->set($template, $generatedModuleName.DIRECTORY_SEPARATOR.'templates', $retval); 72 72 } 73 73 } branches/slickrick/lib/generator/sfPropelAdminGenerator.class.php
r1450 r1464 72 72 // theme exists? 73 73 $theme = isset($this->params['theme']) ? $this->params['theme'] : 'default'; 74 if (!is_dir(sfConfig::get('sf_symfony_data_dir').'/generator/sfPropelAdmin/'.$theme.'/template')) 74 $themeDir = sfConfig::get('sf_symfony_data_dir').'/generator/sfPropelAdmin/'.$theme.'/template'; 75 if (!is_dir($themeDir)) 75 76 { 76 77 $error = 'The theme "%s" does not exist.'; … … 80 81 81 82 $this->setTheme($theme); 82 $templateFiles = array( 83 'listSuccess', 'editSuccess', '_filters', 84 '_list_th_'.$this->getParameterValue('list.layout', 'tabular'), '_list_td_'.$this->getParameterValue('list.layout', 'tabular'), 85 '_list_th_tabular', 86 '_list_header', '_edit_header', '_list_footer', '_edit_footer', 87 '_list_td_actions', '_list_actions', '_edit_actions', 88 ); 83 84 $templateFiles = sfFinder::type('file')->name('*.php')->relative()->in($themeDir.'/templates'); 89 85 $this->generatePhpFiles($this->generatedModuleName, $templateFiles); 90 86 branches/slickrick/lib/generator/sfPropelCrudGenerator.class.php
r1450 r1464 83 83 84 84 $this->setTheme($theme); 85 $this->generatePhpFiles($this->generatedModuleName, array('listSuccess ', 'editSuccess', 'showSuccess'));85 $this->generatePhpFiles($this->generatedModuleName, array('listSuccess.php', 'editSuccess.php', 'showSuccess.php')); 86 86 87 87 // require generated action class branches/slickrick/lib/helper/DebugHelper.php
r1450 r1464 11 11 function log_message($message, $priority = 'info') 12 12 { 13 sfContext::getInstance()->getLogger()->log($message, constant('SF_PEAR_LOG_'.strtoupper($priority))); 13 if (sfConfig::get('sf_logging_active')) 14 { 15 sfContext::getInstance()->getLogger()->log($message, constant('SF_PEAR_LOG_'.strtoupper($priority))); 16 } 14 17 } branches/slickrick/lib/helper/FormHelper.php
r1449 r1464 493 493 });'; 494 494 495 if (isset($options['tinymce_options'])) 496 { 497 unset($options['tinymce_options']); 498 } 499 495 500 return 496 501 content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')). branches/slickrick/lib/vendor/propel/util/BasePeer.php
r1344 r1464 833 833 .($selectModifiers ? implode(" ", $selectModifiers) . " " : "") 834 834 .implode(", ", $selectClause) 835 ." FROM ".( count($fromClause) > 1 ? "(".implode(", ", $fromClause).")": implode(", ", $fromClause))835 ." FROM ".((substr(get_class($db), 0, 7) == 'DBMySQL') ? (count($fromClause) > 1 ? "(".implode(", ", $fromClause).")" : implode(", ", $fromClause)) : implode(", ", $fromClause)) 836 836 .($joinClause ? ' ' . implode(' ', $joinClause) : '') 837 837 .($whereClause ? " WHERE ".implode(" AND ", $whereClause) : "")