Changeset 62
- Timestamp:
- 07/12/08 13:41:34 (4 months ago)
- Files:
-
- trunk/apps/main/config/config.php (deleted)
- trunk/apps/main/config/factories.yml (modified) (1 diff)
- trunk/apps/main/i18n/es (added)
- trunk/apps/main/i18n/es/messages.xml (added)
- trunk/apps/main/lib/myActions.class.php (modified) (10 diffs)
- trunk/apps/main/modules/applications/actions/actions.class.php (modified) (1 diff)
- trunk/config/app.yml-dist (modified) (1 diff)
- trunk/config/search.yml (modified) (1 diff)
- trunk/lib/form/BlogPostForm.class.php (added)
- trunk/lib/form/application/ApplicationForm.class.php (modified) (3 diffs)
- trunk/lib/model/Application.php (modified) (2 diffs)
- trunk/lib/model/ApplicationPeer.php (modified) (1 diff)
- trunk/plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/om/BasesfLocalization.php (modified) (3 diffs)
- trunk/plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/om/BasesfLocalizationPeer.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/apps/main/config/factories.yml
r49 r62 1 prod: 2 logger: 3 class: sfNoLogger 4 param: 5 level: err 6 loggers: ~ 1 7 prod: 2 8 logger: trunk/apps/main/lib/myActions.class.php
r54 r62 92 92 protected function purgeHomepage() 93 93 { 94 $cacheManager = $this->getViewCacheManager(); 95 if ($cacheManager) 94 if ($cacheManager = $this->getViewCacheManager()) 96 95 { 97 96 $cacheManager->remove('home/index'); … … 101 100 protected function purgeHomepages() 102 101 { 103 $cacheManager = $this->getViewCacheManager(); 104 if ($cacheManager) 102 if ($cacheManager = $this->getViewCacheManager()) 105 103 { 106 104 $cacheManager->remove('applications/home'); … … 116 114 protected function purgeApplicationRelatedCache(Application $application) 117 115 { 118 $cacheManager = $this->getViewCacheManager(); 119 if ($cacheManager) 116 if ($cacheManager = $this->getViewCacheManager()) 120 117 { 121 118 $cacheManager->remove('applications/home'); … … 132 129 protected function purgeCompanyRelatedCache(Company $company) 133 130 { 134 $cacheManager = $this->getViewCacheManager(); 135 if ($cacheManager) 131 if ($cacheManager = $this->getViewCacheManager()) 136 132 { 137 133 $cacheManager->remove('companies/home'); … … 148 144 protected function purgeJobRelatedCache(Job $job) 149 145 { 150 $cacheManager = $this->getViewCacheManager(); 151 if ($cacheManager) 146 if ($cacheManager = $this->getViewCacheManager()) 152 147 { 153 148 $cacheManager->remove('jobs/home'); … … 164 159 protected function purgePersonRelatedCache(sfGuardUser $person) 165 160 { 166 $cacheManager = $this->getViewCacheManager(); 167 if ($cacheManager) 161 if ($cacheManager = $this->getViewCacheManager()) 168 162 { 169 163 $cacheManager->remove('people/home'); … … 176 170 protected function purgeRecommendationRelatedCache(Recommendation $recommendation) 177 171 { 178 $cacheManager = $this->getViewCacheManager(); 179 if ($cacheManager) 172 if ($cacheManager = $this->getViewCacheManager()) 180 173 { 181 174 $cacheManager->remove('people/details?username='.$recommendation->getsfGuardUserRelatedByRecommendedId()->getUsername()); … … 188 181 protected function purgeApplicationCompanyRelatedCache(ApplicationCompany $app_company) 189 182 { 190 $cacheManager = $this->getViewCacheManager(); 191 if ($cacheManager) 183 if ($cacheManager = $this->getViewCacheManager()) 192 184 { 193 185 $cacheManager->remove('application/details?slug='.$app_company->getApplication()->getSlug()); … … 200 192 protected function purgeApplicationDeveloperRelatedCache(ApplicationDeveloper $app_person) 201 193 { 202 $cacheManager = $this->getViewCacheManager(); 203 if ($cacheManager) 194 if ($cacheManager = $this->getViewCacheManager()) 204 195 { 205 196 $cacheManager->remove('application/details?slug='.$app_person->getApplication()->getSlug()); … … 212 203 protected function purgeCompanyPersonRelatedCache(CompanyPerson $company_person) 213 204 { 214 $cacheManager = $this->getViewCacheManager(); 215 if ($cacheManager) 205 if ($cacheManager = $this->getViewCacheManager()) 216 206 { 217 207 $cacheManager->remove('company/details?slug='.$company_person->getCompany()->getSlug()); trunk/apps/main/modules/applications/actions/actions.class.php
r58 r62 43 43 { 44 44 // Set the submitter id from the session 45 $submitter_id = $this->getUser()->isAdmin() && $application->getSubmitterId() ? $application->getSubmitterId() : $this->getUser()->getId(); 45 46 $params = array_merge($request->getParameter('application'), 46 array('submitter_id' => $ this->getUser()->getId()));47 array('submitter_id' => $submitter_id)); 47 48 $this->form->bind($params, $request->getFiles('application')); 48 49 49 if (!$this->form->isValid() or !$this->form->save())50 if (!$this->form->isValid() or is_null($this->form->save())) 50 51 { 51 52 return sfView::SUCCESS; trunk/config/app.yml-dist
r56 r62 31 31 32 32 cultures: 33 enabled: [en, fr ]33 enabled: [en, fr, pt, es] 34 34 35 35 events: trunk/config/search.yml
r2 r62 119 119 120 120 index: 121 cultures: [en, fr ]121 cultures: [en, fr, pt, es] 122 122 encoding: UTF-8 123 123 analyzer: utf8num trunk/lib/form/application/ApplicationForm.class.php
r57 r62 13 13 $context = sfContext::getInstance(); 14 14 $culture = $context->getUser()->getCulture(); 15 sfLoader::loadHelpers('I18n');15 //sfLoader::loadHelpers('I18n'); 16 16 17 17 // Unset unused widgets 18 unset($this['created_at'], 18 unset($this['id'], 19 $this['created_at'], 19 20 $this['updated_at'], 20 21 $this['slug'], … … 29 30 30 31 // 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)); 32 33 $this->validatorSchema['screenshot_path'] = new sfValidatorFile(array('max_size' => 512000, 'required' => false)); 33 34 $this->validatorSchema['country'] = new sfValidatorI18nChoiceCountry(array('culture' => $culture, 'required' => false)); … … 40 41 new sfValidatorUrl(), 41 42 new sfValidatorChoice(array('choices' => array('http://', ''))), 42 ) , array('required' => false));43 )); 43 44 44 45 // Defaults trunk/lib/model/Application.php
r58 r62 17 17 return $this->getName(); 18 18 } 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 } 19 60 20 61 /** … … 186 227 $c->add(ApplicationCompanyPeer::COMPANY_ID, $company_id); 187 228 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); 188 244 } 189 245 trunk/lib/model/ApplicationPeer.php
r2 r62 65 65 return $results; 66 66 } 67 67 68 68 /** 69 69 * Get recent applications trunk/plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/om/BasesfLocalization.php
r55 r62 73 73 { 74 74 75 76 77 if ($v !== null && !is_int($v) && is_numeric($v)) { 75 if ($v !== null && !is_int($v) && is_numeric($v)) { 78 76 $v = (int) $v; 79 77 } … … 89 87 { 90 88 91 92 93 if ($v !== null && !is_string($v)) { 89 if ($v !== null && !is_string($v)) { 94 90 $v = (string) $v; 95 91 } … … 105 101 { 106 102 107 108 109 if ($v !== null && !is_int($v) && is_numeric($v)) { 103 if ($v !== null && !is_int($v) && is_numeric($v)) { 110 104 $v = (int) $v; 111 105 } trunk/plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/om/BasesfLocalizationPeer.php
r55 r62 58 58 public static function getMapBuilder() 59 59 { 60 include_once 'plugins/sfPropelActAsLocalizableBehaviorPlugin/lib/model/map/sfLocalizationMapBuilder.php';61 60 return BasePeer::getMapBuilder('plugins.sfPropelActAsLocalizableBehaviorPlugin.lib.model.map.sfLocalizationMapBuilder'); 62 61 } … … 165 164 { 166 165 167 foreach (sfMixer::getCallables('BasesfLocalizationPeer: addDoSelectRS:addDoSelectRS') as $callable)166 foreach (sfMixer::getCallables('BasesfLocalizationPeer:doSelectRS:doSelectRS') as $callable) 168 167 { 169 168 call_user_func($callable, 'BasesfLocalizationPeer', $criteria, $con); … … 200 199 return $results; 201 200 } 201 202 static public function getUniqueColumnNames() 203 { 204 return array(array('model_name', 'model_id')); 205 } 202 206 203 207 public static function getTableMap() … … 422 426 } 423 427 } 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'); 426 429 }
