Changeset 62

Show
Ignore:
Timestamp:
07/12/08 13:41:34 (2 years ago)
Author:
nperriault
Message:

[1.1] added es translation + advance in forms migration

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/apps/main/config/factories.yml

    r49 r62  
     1prod: 
     2  logger: 
     3    class:   sfNoLogger 
     4    param: 
     5      level:   err 
     6      loggers: ~ 
    17prod: 
    28  logger: 
  • trunk/apps/main/lib/myActions.class.php

    r54 r62  
    9292  protected function purgeHomepage() 
    9393  { 
    94     $cacheManager = $this->getViewCacheManager(); 
    95     if ($cacheManager) 
     94    if ($cacheManager = $this->getViewCacheManager()) 
    9695    { 
    9796      $cacheManager->remove('home/index'); 
     
    101100  protected function purgeHomepages() 
    102101  { 
    103     $cacheManager = $this->getViewCacheManager(); 
    104     if ($cacheManager) 
     102    if ($cacheManager = $this->getViewCacheManager()) 
    105103    { 
    106104      $cacheManager->remove('applications/home'); 
     
    116114  protected function purgeApplicationRelatedCache(Application $application) 
    117115  { 
    118     $cacheManager = $this->getViewCacheManager(); 
    119     if ($cacheManager) 
     116    if ($cacheManager = $this->getViewCacheManager()) 
    120117    { 
    121118      $cacheManager->remove('applications/home'); 
     
    132129  protected function purgeCompanyRelatedCache(Company $company) 
    133130  { 
    134     $cacheManager = $this->getViewCacheManager(); 
    135     if ($cacheManager) 
     131    if ($cacheManager = $this->getViewCacheManager()) 
    136132    { 
    137133      $cacheManager->remove('companies/home'); 
     
    148144  protected function purgeJobRelatedCache(Job $job) 
    149145  { 
    150     $cacheManager = $this->getViewCacheManager(); 
    151     if ($cacheManager) 
     146    if ($cacheManager = $this->getViewCacheManager()) 
    152147    { 
    153148      $cacheManager->remove('jobs/home'); 
     
    164159  protected function purgePersonRelatedCache(sfGuardUser $person) 
    165160  { 
    166     $cacheManager = $this->getViewCacheManager(); 
    167     if ($cacheManager) 
     161    if ($cacheManager = $this->getViewCacheManager()) 
    168162    { 
    169163      $cacheManager->remove('people/home'); 
     
    176170  protected function purgeRecommendationRelatedCache(Recommendation $recommendation) 
    177171  { 
    178     $cacheManager = $this->getViewCacheManager(); 
    179     if ($cacheManager) 
     172    if ($cacheManager = $this->getViewCacheManager()) 
    180173    { 
    181174      $cacheManager->remove('people/details?username='.$recommendation->getsfGuardUserRelatedByRecommendedId()->getUsername()); 
     
    188181  protected function purgeApplicationCompanyRelatedCache(ApplicationCompany $app_company) 
    189182  { 
    190     $cacheManager = $this->getViewCacheManager(); 
    191     if ($cacheManager) 
     183    if ($cacheManager = $this->getViewCacheManager()) 
    192184    { 
    193185      $cacheManager->remove('application/details?slug='.$app_company->getApplication()->getSlug()); 
     
    200192  protected function purgeApplicationDeveloperRelatedCache(ApplicationDeveloper $app_person) 
    201193  { 
    202     $cacheManager = $this->getViewCacheManager(); 
    203     if ($cacheManager) 
     194    if ($cacheManager = $this->getViewCacheManager()) 
    204195    { 
    205196      $cacheManager->remove('application/details?slug='.$app_person->getApplication()->getSlug()); 
     
    212203  protected function purgeCompanyPersonRelatedCache(CompanyPerson $company_person) 
    213204  { 
    214     $cacheManager = $this->getViewCacheManager(); 
    215     if ($cacheManager) 
     205    if ($cacheManager = $this->getViewCacheManager()) 
    216206    { 
    217207      $cacheManager->remove('company/details?slug='.$company_person->getCompany()->getSlug()); 
  • trunk/apps/main/modules/applications/actions/actions.class.php

    r58 r62  
    4343    { 
    4444      // Set the submitter id from the session 
     45      $submitter_id = $this->getUser()->isAdmin() && $application->getSubmitterId() ? $application->getSubmitterId() : $this->getUser()->getId(); 
    4546      $params = array_merge($request->getParameter('application'),  
    46                             array('submitter_id' => $this->getUser()->getId())); 
     47                            array('submitter_id' => $submitter_id)); 
    4748      $this->form->bind($params, $request->getFiles('application')); 
    4849       
    49       if (!$this->form->isValid() or !$this->form->save()) 
     50      if (!$this->form->isValid() or is_null($this->form->save())) 
    5051      { 
    5152        return sfView::SUCCESS; 
  • trunk/config/app.yml-dist

    r56 r62  
    3131 
    3232  cultures: 
    33     enabled:             [en, fr
     33    enabled:             [en, fr, pt, es
    3434 
    3535  events: 
  • trunk/config/search.yml

    r2 r62  
    119119 
    120120  index: 
    121     cultures:               [en, fr
     121    cultures:               [en, fr, pt, es
    122122    encoding:               UTF-8 
    123123      analyzer:             utf8num 
  • trunk/lib/form/application/ApplicationForm.class.php

    r57 r62  
    1313    $context = sfContext::getInstance(); 
    1414    $culture = $context->getUser()->getCulture(); 
    15     sfLoader::loadHelpers('I18n'); 
     15    //sfLoader::loadHelpers('I18n'); 
    1616     
    1717    // Unset unused widgets 
    18     unset($this['created_at'],  
     18    unset($this['id'], 
     19          $this['created_at'],  
    1920          $this['updated_at'], 
    2021          $this['slug'],  
     
    2930     
    3031    // Overriding validators 
    31     $this->validatorSchema['tags']            = new sfValidatorRegex(array('pattern' => '/[0-9\w-_ ]/i', 'required' => false)); 
     32    $this->validatorSchema['tags']            = new sfValidatorRegex(array('pattern' => '/[0-9\w.-_, ]/i', 'required' => false)); 
    3233    $this->validatorSchema['screenshot_path'] = new sfValidatorFile(array('max_size' => 512000, 'required' => false));  
    3334    $this->validatorSchema['country']         = new sfValidatorI18nChoiceCountry(array('culture' => $culture, 'required' => false)); 
     
    4041      new sfValidatorUrl(), 
    4142      new sfValidatorChoice(array('choices' => array('http://', ''))), 
    42     ), array('required' => false)); 
     43    )); 
    4344     
    4445    // Defaults 
  • trunk/lib/model/Application.php

    r58 r62  
    1717    return $this->getName(); 
    1818  } 
     19   
     20  /** 
     21   * Fills current Application with array parameters, including tags 
     22   * 
     23   * @param  array   $arr 
     24   * @param  string  $keyType 
     25   */ 
     26  public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) 
     27  { 
     28    parent::fromArray($arr, $keyType); 
     29     
     30    foreach (array('tags', 'Tags') as $tagField) 
     31    { 
     32      if (array_key_exists($tagField, $arr)) 
     33      { 
     34        $this->setTags($arr[$tagField]); 
     35      } 
     36    } 
     37  } 
     38   
     39  /** 
     40   * Converts current Application to an associative array 
     41   * 
     42   * @param  string $keyType 
     43   * @return array 
     44   */ 
     45  public function toArray($keyType = BasePeer::TYPE_PHPNAME) 
     46  { 
     47    $arr = parent::toArray($keyType); 
     48     
     49    if (BasePeer::TYPE_FIELDNAME == $keyType) 
     50    { 
     51      $arr['tags'] = $this->getTagsString(); 
     52    } 
     53    else if (BasePeer::TYPE_PHPNAME == $keyType) 
     54    { 
     55      $arr['Tags'] = $this->getTagsString(); 
     56    } 
     57     
     58    return $arr; 
     59  } 
    1960 
    2061  /** 
     
    186227    $c->add(ApplicationCompanyPeer::COMPANY_ID, $company_id); 
    187228    return ($this->countApplicationCompanys($c) > 0); 
     229  } 
     230   
     231  /** 
     232   * Checks if an application is owned by a given user 
     233   * 
     234   * @param int|sfGuardUser $user 
     235   */ 
     236  public function isOwnedBy($user_id) 
     237  { 
     238    if ($user_id instanceof sfGuardUser) 
     239    { 
     240      $user_id = $user_id->getId(); 
     241    } 
     242     
     243    return ($this->getSubmitterId() === $user_id); 
    188244  } 
    189245 
  • trunk/lib/model/ApplicationPeer.php

    r2 r62  
    6565    return $results; 
    6666  } 
    67  
     67   
    6868  /** 
    6969   * Get recent applications 
  • trunk/plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/om/BasesfLocalization.php

    r55 r62  
    7373        { 
    7474 
    75                  
    76                  
    77                 if ($v !== null && !is_int($v) && is_numeric($v)) { 
     75                                                if ($v !== null && !is_int($v) && is_numeric($v)) { 
    7876                        $v = (int) $v; 
    7977                } 
     
    8987        { 
    9088 
    91                  
    92                  
    93                 if ($v !== null && !is_string($v)) { 
     89                                                if ($v !== null && !is_string($v)) { 
    9490                        $v = (string) $v;  
    9591                } 
     
    105101        { 
    106102 
    107                  
    108                  
    109                 if ($v !== null && !is_int($v) && is_numeric($v)) { 
     103                                                if ($v !== null && !is_int($v) && is_numeric($v)) { 
    110104                        $v = (int) $v; 
    111105                } 
  • trunk/plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/om/BasesfLocalizationPeer.php

    r55 r62  
    5858        public static function getMapBuilder() 
    5959        { 
    60                 include_once 'plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/map/sfLocalizationMapBuilder.php'; 
    6160                return BasePeer::getMapBuilder('plugins.sfPropelActAsLocalizableBehaviorPlugin.lib.model.map.sfLocalizationMapBuilder'); 
    6261        } 
     
    165164        { 
    166165 
    167     foreach (sfMixer::getCallables('BasesfLocalizationPeer:addDoSelectRS:addDoSelectRS') as $callable) 
     166    foreach (sfMixer::getCallables('BasesfLocalizationPeer:doSelectRS:doSelectRS') as $callable) 
    168167    { 
    169168      call_user_func($callable, 'BasesfLocalizationPeer', $criteria, $con); 
     
    200199                return $results; 
    201200        } 
     201 
     202  static public function getUniqueColumnNames() 
     203  { 
     204    return array(array('model_name', 'model_id')); 
     205  } 
    202206         
    203207        public static function getTableMap() 
     
    422426        } 
    423427} else { 
    424                         require_once 'plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/map/sfLocalizationMapBuilder.php'; 
    425         Propel::registerMapBuilder('plugins.sfPropelActAsLocalizableBehaviorPlugin.lib.model.map.sfLocalizationMapBuilder'); 
     428                        Propel::registerMapBuilder('plugins.sfPropelActAsLocalizableBehaviorPlugin.lib.model.map.sfLocalizationMapBuilder'); 
    426429}