To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Changeset 1097

Show
Ignore:
Timestamp:
04/29/10 16:21:26 (22 months ago)
Author:
dordille
Message:

Allow comments to be disabled application wide.
Disable template selector if only one template exists.

Location:
plugins/apostropheBlogPlugin/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostropheBlogPlugin/trunk/lib/form/doctrine/PluginaBlogItemForm.class.php

    r1062 r1097  
    3232    } 
    3333     
    34  
    3534    $this->setWidget('categories_list_add', 
    3635      new sfWidgetFormInputHidden()); 
     
    3938      new sfValidatorPass()); 
    4039 
    41        
    4240    $this->setWidget('editors_list', 
    4341      new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardUser', 'query' => $q))); 
    4442    $this->setValidator('editors_list', 
    4543      new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardUser', 'query' => $q, 'required' => false))); 
    46      
    47     $this->setWidget('template',  
     44 
     45    $this->setWidget('template', 
    4846      new sfWidgetFormChoice(array('multiple' => false, 'choices' => sfConfig::get('app_aBlog_templates')))); 
    4947    $this->setValidator('template', 
    5048      new sfValidatorChoice(array('required' => true, 'multiple' => false, 'choices' => array_flip(sfConfig::get('app_aBlog_templates'))))); 
    51        
     49 
     50    if(count(sfConfig::get('app_aBlog_templates')) <= 1) 
     51    { 
     52      unset($this['template']); 
     53    } 
     54 
     55    if(!sfConfig::get('app_aBlog_comments', false)) 
     56    { 
     57      unset($this['allow_comments']); 
     58    } 
     59     
    5260    $this->widgetSchema['tags']       = new sfWidgetFormInput(array('default' => implode(', ', $this->getObject()->getTags())), array('class' => 'tag-input', 'autocomplete' => 'off')); 
    5361    $this->validatorSchema['tags']    = new sfValidatorString(array('required' => false)); 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/templates/_form.php

    r1096 r1097  
    131131 
    132132 
    133 <?php // Blog Comments Enabled?Disabled Toggle ?> 
     133<?php if(isset($form['allow_comments'])): ?> 
    134134<hr /> 
    135135<div class="comments section"> 
     
    141141         
    142142</div> 
     143<?php endif ?> 
    143144 
    144145<script type="text/javascript" charset="utf-8">