Development

Changeset 1369

You must first sign up to be able to contribute.

Changeset 1369

Show
Ignore:
Timestamp:
05/15/06 23:26:59 (3 years ago)
Author:
pookey
Message:

pookey: merging trunk r1368 to my branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/pookey/data/generator/sfPropelAdmin/default/template/actions/actions.class.php

    r1355 r1369  
    155155    if (!$this->getRequest()->hasErrors() && $this->getRequest()->getFileSize('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]')) 
    156156    { 
    157 <?php else: ?> 
     157<?php elseif ($type != CreoleTypes::BOOLEAN): ?> 
    158158    if (isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'])) 
    159159    { 
     
    179179      } 
    180180<?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); 
    182182<?php else: ?> 
    183183      $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']); 
    184184<?php endif; ?> 
    185     } 
     185<?php if ($type != CreoleTypes::BOOLEAN): ?> 
     186    } 
     187<?php endif; ?> 
    186188<?php if ($credentials): ?> 
    187189      } 
  • branches/pookey/data/web/sf/css/sf_admin/main.css

    r994 r1369  
    4444  margin: 8px 0; 
    4545  padding: 3px; 
    46   padding-left: 5px; 
     46  padding-left: 0px; 
    4747  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; 
    5250} 
    5351 
     
    253251.sf_admin_action_reset_filter 
    254252{ 
    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; 
    256254  border-right: 4px solid #E75C58 !important; 
    257255} 
  • branches/pookey/data/web/sf/css/sf_web_debug/main.css

    r1355 r1369  
    1414  text-decoration: none; 
    1515  border: none; 
    16   background-color: #eee
     16  background-color: transparent
    1717  color: #000; 
    1818} 
     
    2525#sfWebDebugBar 
    2626{ 
    27   position: fixed
     27  position: absolute
    2828  margin: 0; 
    2929  padding: 1px 0; 
     
    3333  filter: alpha(opacity:80); 
    3434  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; 
    4140} 
    4241 
     
    5655  display: inline; 
    5756  list-style: none; 
     57  margin: 0; 
    5858  padding: 0 5px; 
    5959  border-right: 1px solid #aaa; 
     
    6262#sfWebDebugBar .menu li.last 
    6363{ 
    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; 
    6674} 
    6775 
     
    132140  display: inline; 
    133141  list-style: none; 
     142  margin: 0; 
    134143  padding: 0 5px; 
    135144  border-right: 1px solid #aaa; 
     
    149158  list-style: none; 
    150159  display: inline; 
     160  margin: 0; 
    151161  padding: 0 5px; 
    152162  border-right: 1px solid #aaa; 
     
    155165#sfWebDebugConfigSummary li.last 
    156166{ 
    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 
    167178{ 
    168179  background-color: orange; 
    169180} 
    170181 
    171 #sfWebDebug .error 
     182.sfWebDebugError, .sfWebDebugError td 
    172183{ 
    173184  background-color: #f99; 
     
    203214  border: 0; 
    204215  width: 100%; 
    205 } 
    206  
    207 #sfWebDebugLogs tr 
    208 { 
    209   padding: 0; 
    210   margin: 0; 
    211   border: 0; 
    212 } 
    213  
    214 #sfWebDebugLogs td 
    215 { 
    216   margin: 0; 
    217   border: 0; 
    218   padding: 1px 3px; 
    219216  font-family: Arial; 
    220217  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; 
    221232  vertical-align: top; 
    222   background-color: #ddd; 
    223233} 
    224234 
     
    228238  border: 0; 
    229239  padding: 1px 3px; 
    230   font-family: Arial; 
    231   font-size: 11px; 
    232240  vertical-align: top; 
    233   background-color: #666
     241  background-color: #999
    234242  color: #eee; 
    235243} 
  • branches/pookey/data/web/sf/js/sf_web_debug/main.js

    r1355 r1369  
    3939    document.getElementById('sfWebDebugLog').style.display = 'none'; 
    4040    document.getElementById('sfWebDebugConfig').style.display = 'none'; 
     41    document.getElementById('sfWebDebugDatabaseDetails').style.display = 'none'; 
    4142  } 
    4243 
  • branches/pookey/doc/book/content/cache.txt

    r1355 r1369  
    9696Now all the templates using this partial won't actually execute the PHP code of the partial, but use the cached version instead.  
    9797 
    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 caling 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. 
    9999 
    100100Just 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  
    377377    [php] 
    378378    ... 
    379     <div id="#sidebar"> 
     379    <div id="sidebar"> 
    380380      <?php include_component_slot('sidebar') ?> 
    381381    </div>  
  • branches/pookey/lib/debug/sfWebDebug.class.php

    r1355 r1369  
    167167 
    168168    // max priority 
    169     $log_image = ''; 
     169    $max_priority = ''; 
    170170    if ($sf_logging_active = sfConfig::get('sf_logging_active')) 
    171171    { 
    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(); 
    186177    if ($sf_logging_active) 
    187178    { 
    188       $logs = '<table id="sfWebDebugLogs">'; 
    189       $logs .= "<tr> 
    190         <th>#</th> 
    191         <th>&nbsp;</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>&nbsp;</th> 
     183          <th>ms</th> 
     184          <th>type</th> 
     185          <th>message</th> 
     186        </tr>'."\n"; 
    196187      $line_nb = 0; 
    197188      foreach($this->log as $logEntry) 
     
    199190        $log = $logEntry->getMessage(); 
    200191 
    201         if ($logEntry->getPriority() >= 6) 
     192        $priority = $this->getPriority($logEntry->getPriority()); 
     193 
     194        if (strpos($type = $logEntry->getType(), 'sf') === 0) 
    202195        { 
    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); 
    216197        } 
    217198 
     
    231212        $log = $this->formatLogLine($type, $log); 
    232213 
     214        // sql queries log 
     215        if (preg_match('/executeQuery.+?\:\s+(.+)$/', $log, $match)) 
     216        { 
     217          $sql_logs[] .= $match[1]."\n"; 
     218        } 
     219 
    233220        ++$line_nb; 
    234221        $logs .= sprintf("<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td>%s</td><td>%s</td><td>+%s&nbsp;</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); 
     
    256243    if (sfConfig::get('sf_logging_active')) 
    257244    { 
    258       $logLink = '<li><a href="#" onclick="document.getElementById(\'sfWebDebugConfig\').style.display=\'none\';sfWebDebugToggle(\'sfWebDebugLog\')"><img src="'.$this->base_image_path.'/comment.png" /> logs &amp; 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 &amp; msgs</a></li>'; 
    259246    } 
    260247 
    261248    // database information 
    262249    $dbInfo = ''; 
     250    $dbInfoDetails = ''; 
    263251    if (null !== ($nb = $this->getDatabaseRequestNumber())) 
    264252    { 
    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      '; 
    266260    } 
    267261 
     
    309303    $result .= ' 
    310304    <div id="sfWebDebug"> 
    311       <div id="sfWebDebugBar"
     305      <div id="sfWebDebugBar" class="sfWebDebug'.ucfirst($max_priority).'"
    312306        <a href="#" onclick="sfWebDebugToggleMenu()"><img src="'.$this->base_image_path.'/sf.png" /></a> 
    313307        <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 &amp; 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 &amp; config</a></li> 
    315309          '.$cacheLink.' 
    316310          '.$logLink.' 
     
    330324      <h1>Configuration and request variables</h1> 
    331325      '.$this->getCurrentConfigAsHtml().' 
     326      </div> 
     327 
     328      <div id="sfWebDebugDatabaseDetails" class="top" style="display: none"> 
     329      <h1>SQL queries</h1> 
     330      '.$dbInfoDetails 
     331      .' 
    332332      </div> 
    333333    </div> 
     
    373373    $content = ' 
    374374    <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> 
    376376    '; 
    377377 
     
    437437    return $retval; 
    438438  } 
     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  } 
    439455} 
    440456 
  • branches/pookey/lib/exception/sfException.class.php

    r1355 r1369  
    199199  private function formatArrayAsHtml($values) 
    200200  { 
    201     return '<pre>'.sfYaml::Dump($values).'</pre>'; 
     201    return '<pre>'.@sfYaml::Dump($values).'</pre>'; 
    202202  } 
    203203 
  • branches/pookey/lib/generator/sfPropelAdminGenerator.class.php

    r1355 r1369  
    262262    if ($column->isPartial()) 
    263263    { 
    264       return "include_partial('".$column->getName()."', array('{$this->getSingularName()}' => \${$this->getSingularName()}))"; 
     264      return "include_partial('".$column->getName()."', array('type' => 'edit', '{$this->getSingularName()}' => \${$this->getSingularName()}))"; 
    265265    } 
    266266 
     
    512512    if ($column->isPartial()) 
    513513    { 
    514       return "include_partial('".$column->getName()."', array('{$this->getSingularName()}' => \${$this->getSingularName()}))"; 
     514      return "include_partial('".$column->getName()."', array('type' => 'list', '{$this->getSingularName()}' => \${$this->getSingularName()}))"; 
    515515    } 
    516516    else if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP) 
     
    521521    elseif ($type == CreoleTypes::BOOLEAN) 
    522522    { 
    523       return "\${$this->getSingularName()}->get{$column->getPhpName()}() ? image_tag('/sf/images/sf_admin/ok.png') : '&nbsp;'"; 
     523      return "\${$this->getSingularName()}->get{$column->getPhpName()}() ? image_tag('/sf/images/sf_admin/tick.png') : '&nbsp;'"; 
    524524    } 
    525525    else 
     
    537537    if ($column->isPartial()) 
    538538    { 
    539       return "include_partial('".$column->getName()."', array('filters' => \$filters))"; 
     539      return "include_partial('type' => 'filter', '".$column->getName()."', array('filters' => \$filters))"; 
    540540    } 
    541541 
  • branches/pookey/lib/validator/sfFileValidator.class.php

    r1100 r1369  
    8484    $this->getParameterHolder()->add($parameters); 
    8585 
     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 
    86109    return true; 
    87110  }