Changeset 1369
- Timestamp:
- 05/15/06 23:26:59 (3 years ago)
- Files:
-
- branches/pookey/data/generator/sfPropelAdmin/default/template/actions/actions.class.php (modified) (2 diffs)
- branches/pookey/data/web/sf/css/sf_admin/main.css (modified) (2 diffs)
- branches/pookey/data/web/sf/css/sf_web_debug/main.css (modified) (10 diffs)
- branches/pookey/data/web/sf/images/sf_admin/reset.png (copied) (copied from trunk/data/web/sf/images/sf_admin/reset.png)
- branches/pookey/data/web/sf/images/sf_admin/tick.png (copied) (copied from trunk/data/web/sf/images/sf_admin/tick.png)
- branches/pookey/data/web/sf/js/sf_web_debug/main.js (modified) (1 diff)
- branches/pookey/doc/book/content/cache.txt (modified) (1 diff)
- branches/pookey/doc/book/content/view.txt (modified) (1 diff)
- branches/pookey/lib/debug/sfWebDebug.class.php (modified) (8 diffs)
- branches/pookey/lib/exception/sfException.class.php (modified) (1 diff)
- branches/pookey/lib/generator/sfPropelAdminGenerator.class.php (modified) (4 diffs)
- branches/pookey/lib/validator/sfFileValidator.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/pookey/data/generator/sfPropelAdmin/default/template/actions/actions.class.php
r1355 r1369 155 155 if (!$this->getRequest()->hasErrors() && $this->getRequest()->getFileSize('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]')) 156 156 { 157 <?php else : ?>157 <?php elseif ($type != CreoleTypes::BOOLEAN): ?> 158 158 if (isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'])) 159 159 { … … 179 179 } 180 180 <?php elseif ($type == CreoleTypes::BOOLEAN): ?> 181 $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']) ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : 0);181 $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']) ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : 0); 182 182 <?php else: ?> 183 183 $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']); 184 184 <?php endif; ?> 185 } 185 <?php if ($type != CreoleTypes::BOOLEAN): ?> 186 } 187 <?php endif; ?> 186 188 <?php if ($credentials): ?> 187 189 } branches/pookey/data/web/sf/css/sf_admin/main.css
r994 r1369 44 44 margin: 8px 0; 45 45 padding: 3px; 46 padding-left: 5px;46 padding-left: 0px; 47 47 color: #555; 48 font-size: 16px; 49 border: 1px solid #ddd; 50 border-left: 4px solid #66f; 51 background-color: #ffc; 48 font-family: "Trebuchet MS", Arial, Verdana, sans-serif; 49 font-size: 25px; 52 50 } 53 51 … … 253 251 .sf_admin_action_reset_filter 254 252 { 255 background: url(/sf/images/sf_admin/ cancel.png) no-repeat 3px 2px;253 background: url(/sf/images/sf_admin/reset.png) no-repeat 3px 2px; 256 254 border-right: 4px solid #E75C58 !important; 257 255 } branches/pookey/data/web/sf/css/sf_web_debug/main.css
r1355 r1369 14 14 text-decoration: none; 15 15 border: none; 16 background-color: #eee;16 background-color: transparent; 17 17 color: #000; 18 18 } … … 25 25 #sfWebDebugBar 26 26 { 27 position: fixed;27 position: absolute; 28 28 margin: 0; 29 29 padding: 1px 0; … … 33 33 filter: alpha(opacity:80); 34 34 z-index: 10000; 35 background-color: #ddd; 36 } 37 38 #sfWebDebugBar a 39 { 40 background-color: #ddd; 35 } 36 37 #sfWebDebugBar[id] 38 { 39 position: fixed; 41 40 } 42 41 … … 56 55 display: inline; 57 56 list-style: none; 57 margin: 0; 58 58 padding: 0 5px; 59 59 border-right: 1px solid #aaa; … … 62 62 #sfWebDebugBar .menu li.last 63 63 { 64 padding: 0; 65 border: 0; 64 margin: 0; 65 padding: 0; 66 border: 0; 67 } 68 69 #sfWebDebugDatabaseDetails li 70 { 71 margin: 0; 72 margin-left: 30px; 73 padding: 5px 0; 66 74 } 67 75 … … 132 140 display: inline; 133 141 list-style: none; 142 margin: 0; 134 143 padding: 0 5px; 135 144 border-right: 1px solid #aaa; … … 149 158 list-style: none; 150 159 display: inline; 160 margin: 0; 151 161 padding: 0 5px; 152 162 border-right: 1px solid #aaa; … … 155 165 #sfWebDebugConfigSummary li.last 156 166 { 157 padding: 0; 158 border: 0; 159 } 160 161 #sfWebDebug .info 162 { 163 background-color: #9f9; 164 } 165 166 #sfWebDebug .warning 167 margin: 0; 168 padding: 0; 169 border: 0; 170 } 171 172 .sfWebDebugInfo, .sfWebDebugInfo td 173 { 174 background-color: #ddd; 175 } 176 177 .sfWebDebugWarning, .sfWebDebugWarning td 167 178 { 168 179 background-color: orange; 169 180 } 170 181 171 #sfWebDebug .error 182 .sfWebDebugError, .sfWebDebugError td 172 183 { 173 184 background-color: #f99; … … 203 214 border: 0; 204 215 width: 100%; 205 }206 207 #sfWebDebugLogs tr208 {209 padding: 0;210 margin: 0;211 border: 0;212 }213 214 #sfWebDebugLogs td215 {216 margin: 0;217 border: 0;218 padding: 1px 3px;219 216 font-family: Arial; 220 217 font-size: 11px; 218 } 219 220 #sfWebDebugLogs tr 221 { 222 padding: 0; 223 margin: 0; 224 border: 0; 225 } 226 227 #sfWebDebugLogs td 228 { 229 margin: 0; 230 border: 0; 231 padding: 1px 3px; 221 232 vertical-align: top; 222 background-color: #ddd;223 233 } 224 234 … … 228 238 border: 0; 229 239 padding: 1px 3px; 230 font-family: Arial;231 font-size: 11px;232 240 vertical-align: top; 233 background-color: # 666;241 background-color: #999; 234 242 color: #eee; 235 243 } branches/pookey/data/web/sf/js/sf_web_debug/main.js
r1355 r1369 39 39 document.getElementById('sfWebDebugLog').style.display = 'none'; 40 40 document.getElementById('sfWebDebugConfig').style.display = 'none'; 41 document.getElementById('sfWebDebugDatabaseDetails').style.display = 'none'; 41 42 } 42 43 branches/pookey/doc/book/content/cache.txt
r1355 r1369 96 96 Now all the templates using this partial won't actually execute the PHP code of the partial, but use the cached version instead. 97 97 98 >**Note**: The `slot` type cache is more powerful than the partial cache, since when an action is cached, the template is not even executed - and if the template contains calls to partials, theses calls are not performed. Therefore, the partial caching is useful only if you don't use action caching in the cal ing action.98 >**Note**: The `slot` type cache is more powerful than the partial cache, since when an action is cached, the template is not even executed - and if the template contains calls to partials, theses calls are not performed. Therefore, the partial caching is useful only if you don't use action caching in the calling action. 99 99 100 100 Just like for actions, partial caching is also relevant when the result of the partial depends on parameters: branches/pookey/doc/book/content/view.txt
r1355 r1369 377 377 [php] 378 378 ... 379 <div id=" #sidebar">379 <div id="sidebar"> 380 380 <?php include_component_slot('sidebar') ?> 381 381 </div> branches/pookey/lib/debug/sfWebDebug.class.php
r1355 r1369 167 167 168 168 // max priority 169 $ log_image= '';169 $max_priority = ''; 170 170 if ($sf_logging_active = sfConfig::get('sf_logging_active')) 171 171 { 172 if ($this->max_priority >= 6) 173 { 174 $log_image = 'info'; 175 } 176 else if ($this->max_priority >= 4) 177 { 178 $log_image = 'warning'; 179 } 180 else 181 { 182 $log_image = 'error'; 183 } 184 } 185 172 $max_priority = $this->getPriority($this->max_priority); 173 } 174 175 $logs = ''; 176 $sql_logs = array(); 186 177 if ($sf_logging_active) 187 178 { 188 $logs = '<table id="sfWebDebugLogs">';189 $logs .= "<tr>190 <th>#</th>191 <th> </th>192 <th>ms</th>193 <th>type</th>194 <th>message</th>195 </tr>\n";179 $logs = '<table id="sfWebDebugLogs"> 180 <tr> 181 <th>#</th> 182 <th> </th> 183 <th>ms</th> 184 <th>type</th> 185 <th>message</th> 186 </tr>'."\n"; 196 187 $line_nb = 0; 197 188 foreach($this->log as $logEntry) … … 199 190 $log = $logEntry->getMessage(); 200 191 201 if ($logEntry->getPriority() >= 6) 192 $priority = $this->getPriority($logEntry->getPriority()); 193 194 if (strpos($type = $logEntry->getType(), 'sf') === 0) 202 195 { 203 $priority = 'info'; 204 } 205 else if ($logEntry->getPriority() >= 4) 206 { 207 $priority = 'warning'; 208 } 209 else 210 { 211 $priority = 'error'; 212 } 213 214 if (strpos($type = $logEntry->getType(), 'sf') === 0) { 215 $type = substr($type, 2); 196 $type = substr($type, 2); 216 197 } 217 198 … … 231 212 $log = $this->formatLogLine($type, $log); 232 213 214 // sql queries log 215 if (preg_match('/executeQuery.+?\:\s+(.+)$/', $log, $match)) 216 { 217 $sql_logs[] .= $match[1]."\n"; 218 } 219 233 220 ++$line_nb; 234 221 $logs .= sprintf("<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td>%s</td><td>%s</td><td>+%s </td><td><span class=\"sfWebDebugLogType\">%s</span></td><td>%s%s</td></tr>\n", ucfirst($priority), $logEntry->getType(), $line_nb, image_tag($this->base_image_path.'/'.$priority.'.png'), $logEntry->getElapsedTime(), $type, $log, $debug_info); … … 256 243 if (sfConfig::get('sf_logging_active')) 257 244 { 258 $logLink = '<li><a href="#" onclick="document.getElementById(\'sfWebDebugConfig\').style.display=\'none\'; sfWebDebugToggle(\'sfWebDebugLog\')"><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\')"><img src="'.$this->base_image_path.'/comment.png" /> logs & msgs</a></li>'; 259 246 } 260 247 261 248 // database information 262 249 $dbInfo = ''; 250 $dbInfoDetails = ''; 263 251 if (null !== ($nb = $this->getDatabaseRequestNumber())) 264 252 { 265 $dbInfo = '<li><img src="'.$this->base_image_path.'/database.png" /> '.$nb.'</li>'; 253 $dbInfo = '<li><a href="#" onclick="document.getElementById(\'sfWebDebugConfig\').style.display=\'none\';document.getElementById(\'sfWebDebugLog\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugDatabaseDetails\')"><img src="'.$this->base_image_path.'/database.png" /> '.$nb.'</a></li>'; 254 255 $dbInfoDetails = ' 256 <div id="sfWebDebugDatabaseDetails"> 257 <ol><li>'.implode('</li><li>', $sql_logs).'</li></ol> 258 </div> 259 '; 266 260 } 267 261 … … 309 303 $result .= ' 310 304 <div id="sfWebDebug"> 311 <div id="sfWebDebugBar" >305 <div id="sfWebDebugBar" class="sfWebDebug'.ucfirst($max_priority).'"> 312 306 <a href="#" onclick="sfWebDebugToggleMenu()"><img src="'.$this->base_image_path.'/sf.png" /></a> 313 307 <ul id="sfWebDebugDetails" class="menu"> 314 <li><a href="#" onclick="document.getElementById(\'sfWebDebugLog\').style.display=\'none\'; sfWebDebugToggle(\'sfWebDebugConfig\')"><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\')"><img src="'.$this->base_image_path.'/config.png" /> vars & config</a></li> 315 309 '.$cacheLink.' 316 310 '.$logLink.' … … 330 324 <h1>Configuration and request variables</h1> 331 325 '.$this->getCurrentConfigAsHtml().' 326 </div> 327 328 <div id="sfWebDebugDatabaseDetails" class="top" style="display: none"> 329 <h1>SQL queries</h1> 330 '.$dbInfoDetails 331 .' 332 332 </div> 333 333 </div> … … 373 373 $content = ' 374 374 <h2>'.$id.' <a href="#" onclick="sfWebDebugToggle(\'sfWebDebug'.$id.'\')"><img src="'.$this->base_image_path.'/toggle.gif" /></a></h2> 375 <div id="sfWebDebug'.$id.'" style="display: none"><pre>'. sfYaml::Dump($values).'</pre></div>375 <div id="sfWebDebug'.$id.'" style="display: none"><pre>'.@sfYaml::Dump($values).'</pre></div> 376 376 '; 377 377 … … 437 437 return $retval; 438 438 } 439 440 private function getPriority($value) 441 { 442 if ($value >= 6) 443 { 444 return 'info'; 445 } 446 else if ($value >= 4) 447 { 448 return 'warning'; 449 } 450 else 451 { 452 return 'error'; 453 } 454 } 439 455 } 440 456 branches/pookey/lib/exception/sfException.class.php
r1355 r1369 199 199 private function formatArrayAsHtml($values) 200 200 { 201 return '<pre>'. sfYaml::Dump($values).'</pre>';201 return '<pre>'.@sfYaml::Dump($values).'</pre>'; 202 202 } 203 203 branches/pookey/lib/generator/sfPropelAdminGenerator.class.php
r1355 r1369 262 262 if ($column->isPartial()) 263 263 { 264 return "include_partial('".$column->getName()."', array(' {$this->getSingularName()}' => \${$this->getSingularName()}))";264 return "include_partial('".$column->getName()."', array('type' => 'edit', '{$this->getSingularName()}' => \${$this->getSingularName()}))"; 265 265 } 266 266 … … 512 512 if ($column->isPartial()) 513 513 { 514 return "include_partial('".$column->getName()."', array(' {$this->getSingularName()}' => \${$this->getSingularName()}))";514 return "include_partial('".$column->getName()."', array('type' => 'list', '{$this->getSingularName()}' => \${$this->getSingularName()}))"; 515 515 } 516 516 else if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP) … … 521 521 elseif ($type == CreoleTypes::BOOLEAN) 522 522 { 523 return "\${$this->getSingularName()}->get{$column->getPhpName()}() ? image_tag('/sf/images/sf_admin/ ok.png') : ' '";523 return "\${$this->getSingularName()}->get{$column->getPhpName()}() ? image_tag('/sf/images/sf_admin/tick.png') : ' '"; 524 524 } 525 525 else … … 537 537 if ($column->isPartial()) 538 538 { 539 return "include_partial(' ".$column->getName()."', array('filters' => \$filters))";539 return "include_partial('type' => 'filter', '".$column->getName()."', array('filters' => \$filters))"; 540 540 } 541 541 branches/pookey/lib/validator/sfFileValidator.class.php
r1100 r1369 84 84 $this->getParameterHolder()->add($parameters); 85 85 86 // pre-defined categories 87 $categories = array( 88 '@web_images' => array( 89 'image/jpeg', 90 'image/pjpeg', 91 'image/png', 92 'image/x-png', 93 'image/gif', 94 ), 95 ); 96 97 if (!is_array($this->getParameter('mime_types'))) 98 { 99 if (isset($categories[$this->getParameter('mime_types')])) 100 { 101 $this->setParameter('mime_types', $categories[$this->getParameter('mime_types')]); 102 } 103 else 104 { 105 $this->setParameter('mime_types', array($this->getParameter('mime_types'))); 106 } 107 } 108 86 109 return true; 87 110 }