[symfony-users] Re: About bug for the sfPropelActAsCommentableBehaviorPlugin 1.2.0
Hi, Xavier Lacot Thanks for your wonderful job. I hope you can add the AJAX feature as optional at the plugin at branch of 1.2.0 Thanks again. Oliver On Jul 18, 11:01 pm, happy oliver wrote: > Hi, Everyone, > > I spent some time to find this plugin namespace is not work properly. > > need to fix two part. > > 1. change the name for field > > _commentForm.php > > > $namespace) ?> > > > to > > > $namespace) ?> > > 2. add the following code at sfcommentingForm.class.php > > $this->validatorSchema->setOption('allow_extra_fields', true); > $this->validatorSchema->setOption('filter_extra_fields', false); > > Then, everything works well. > > I hope this helpful for someone. > > Cheer > > Oliver --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] About bug for the sfPropelActAsCommentableBehaviorPlugin 1.2.0
Hi, Everyone, I spent some time to find this plugin namespace is not work properly. need to fix two part. 1. change the name for field _commentForm.php to 2. add the following code at sfcommentingForm.class.php $this->validatorSchema->setOption('allow_extra_fields', true); $this->validatorSchema->setOption('filter_extra_fields', false); Then, everything works well. I hope this helpful for someone. Cheer Oliver --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: i18n in model::Peer method
Hi, I think whether it is a solution ? For static variable , it can be defined in config file (yml). then use the helper to translate them. Thanks for any advice. Oliver On Jul 17, 12:45 am, Mateusz Kaczmarek wrote: > Trully I'm surprised that symfony can't handle with this situation, > when this pattern (data for form select as static variable in Peer > class) are presented in official tutorial. Maybe ticket will be good > option ? > > @Crafty_Shadow - I will check Your solution when I back home, I think > this will work great - so thanx in advance :-) > > On Jul 16, 9:08 pm, Crafty_Shadow wrote: > > > > > This is quite different from op's question. You can do this when > > sending parameters for a constructor, but the problem was how to > > translate values in an associative array which is a static property of > > an object. It's something of a everyday occurrence, really, so finding > > a valuable solution would be most useful. > > > One way to do it would be through a static method I guess: > > > class JobeetJobPeer extends BaseJobeetJobPeer > > { > > static public $types = array( > > 'full-time' => 'Full time', > > 'part-time' => 'Part time', > > 'freelance' => 'Freelance', > > ); > > public static function getTranslatedTypes() > > { > > $i18n_object = sfContext::getInstance()->getI18n(); > > return array_map(array($i18n_object, '__'), self::$types); > > } > > . > > > On Jul 16, 9:34 pm, Alexandru-Emil Lupu wrote: > > > > i have this > > > > public function executeCommentsForPostFeed() > > > { > > > $text = $this->getRequestParameter('stripped_title'); > > > $date = sfDoctrineBlogTools::getDateFromRequest(); > > > > $this->post = sfDoctrineBlogPost::findByStrippedTitleAndDate($text, > > > $date); > > > > $this->forward404Unless($post); > > > $this->feed = sfFeedPeer::createFromObjects( > > > $comments, > > > array( > > > 'format' => $this->getRequestParameter('format', 'atom1'), > > > 'title' => sfDoctrineBlogTools::__('Comments on post "%1%" > > > from %2%', array('%1%' => $post->getTitle(), '%2%' => > > > sfConfig::get('app_sfSimpleBlog_title', ''))), > > > 'link' => > > > $this->getController()->genUrl('sfSimpleBlog/show?stripped_title='.$post->getStrippedTitle()), > > > 'authorName' => sfConfig::get('app_sfSimpleBlog_author', ''), > > > 'methods' => array('title' => 'getPostTitle', 'authorEmail' => > > > '') > > > ) > > > ); > > > $this->setTemplate('feed'); > > > } > > > > and this > > > > class sfDoctrineBlogTools > > > { > > > > public static function __($text, $args = array(), $catalogue = > > > 'messages') > > > { > > > if (sfConfig::get('sf_i18n')) > > > { > > > return sfContext::getInstance()->getI18N()->__($text, $args, > > > $catalogue); > > > } > > > else > > > { > > > if (empty($args)) > > > { > > > $args = array(); > > > } > > > > // replace object with strings > > > foreach ($args as $key => $value) > > > { > > > if (is_object($value) && method_exists($value, '__toString')) > > > { > > > $args[$key] = $value->__toString(); > > > } > > > } > > > > return strtr($text, $args); > > > } > > > } > > > > On Thu, Jul 16, 2009 at 3:49 PM, Alexandru-Emil Lupu > > > wrote: > > > > > I will paste in this topic my usage tonight .. when i will get home. > > > > Alecs > > > > > On Thu, Jul 16, 2009 at 3:39 PM, Crafty_Shadow > > > > wrote: > > > > >> The problem is not the loading order but the fact that php doesn't > > > >> allow this syntax: > > > >> static public $types = array( > > > >> 'full-time' => TextTools::__('Full time'), > > > >> 'part-time' => TextTools::__('Part time'), > > > >> ... > > > > >> Try it and you'll see. > > > >> It gives "unexpected '(', expecting ')'" because it anticipates the > > > >> closing parentheses for the array. > > > > >> On Jul 16, 3:31 pm, Alexandru-Emil Lupu wrote: > > > >> > HI! > > > >> > i do not have access to the sources atm, but, i think it would work: > > > > >> > > > > >> > public static function __($text, $args = array(), $catalogue = > > > >> 'messages') > > > >> > { > > > >> > if (sfConfig::get('sf_i18n')) > > > >> > { > > > >> > return sfContext::getInstance()->getI18N()->__($text, $args, > > > >> > $catalogue); > > > >> > } > > > >> > else > > > >> > { > > > >> > if (empty($args)) > > > >> > { > > > >> > $args = array(); > > > >> > } > > > > >> > // replace object with strings > > > >> > foreach ($args as $key => $value) > > > >> > { > > > >> > if (is_object($value) && method_exists($value, '__toString')) > > > >> > { > > > >> > $args[$key] = $value->__toString(); > > > >> > } > > > >> > } > > > > >> > return s
[symfony-users] Re: How to deal with uploaded file in embedded form properly?
Hi, everyone, Are there someone met this issue? I appreciate very much for any helps. Thanks, On Jul 13, 1:50 am, happy oliver wrote: > I spent a lot of time to figure out how to deal withembeddedform > with uploaded file. > > I don't use the $this->form->save(). How to deal with uploaded file? I > can see the temp file at temp folder quickly disappeared > automatically. > > Welcome to any answers ! > > public function executeEdit(sfWebRequest $request) > { > $memid = $this->getUser()->getUserId(); > $this->ads= $this->getOrCreateMemberAds(); > > $this->package = $this->getUser()->getMemberPackage(); > $this->form= new Adsorm($this->ads) > > $this->imageforms = array(); > $this->adsPhotos = > $this->getOrCreateImagesForAds($this->advertisement->getId()); > > foreach($this->adsPhotos as $adsPhoto) > { > $imageform = new PhotoForm($adsPhoto); > $this->imageforms[] = $imageform; > $this->form->embedForm('a'.$adsPhoto->getId(), $imageform); > } > if ($request->isMethod('post')) { > $this->form->bind($request->getParameter($this->form->getName > ()), $request->getFiles($this->form->getName())); > if ($this->form->isValid()) > { > > $values = $this->form->getValues(); > foreach($this->imageforms as $imageform) > { > > $file = $values['a'.$imageform->getObject()->getId()] > ['file_path']; > > $imageform->getObject()->setPrice($values['a'.$imageform->getObject()->getId()]['price']); > > > $imageform->getObject()->setFilePath($values['a'.$imageform->getObject()->getId()]['file_path']); > > $imageform->getObject()->save(); > > } > > $this->form->getObject()->setTitle($values['title']); > $this->form->getObject()->setCategoryId(1); > $this->form->getObject()->setDescription($values > ['description']); > $this->form->getObject()->save(); > } > > } > > } > > Thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] How to deal with uploaded file in embedded form properly?
I spent a lot of time to figure out how to deal with embedded form with uploaded file. I don't use the $this->form->save(). How to deal with uploaded file? I can see the temp file at temp folder quickly disappeared automatically. Welcome to any answers ! public function executeEdit(sfWebRequest $request) { $memid = $this->getUser()->getUserId(); $this->ads= $this->getOrCreateMemberAds(); $this->package = $this->getUser()->getMemberPackage(); $this->form = new Adsorm($this->ads) $this->imageforms = array(); $this->adsPhotos = $this->getOrCreateImagesForAds($this- >advertisement->getId()); foreach($this->adsPhotos as $adsPhoto) { $imageform = new PhotoForm($adsPhoto); $this->imageforms[] = $imageform; $this->form->embedForm('a'.$adsPhoto->getId(), $imageform); } if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName ()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $values = $this->form->getValues(); foreach($this->imageforms as $imageform) { $file = $values['a'.$imageform->getObject()->getId()] ['file_path']; $imageform->getObject()->setPrice($values['a'.$imageform- >getObject()->getId()]['price']); $imageform->getObject()->setFilePath($values['a'.$imageform- >getObject()->getId()]['file_path']); $imageform->getObject()->save(); } $this->form->getObject()->setTitle($values['title']); $this->form->getObject()->setCategoryId(1); $this->form->getObject()->setDescription($values ['description']); $this->form->getObject()->save(); } } } Thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: AGAIN: file upload in embedded form (sf 1.2.7)
You can try to deal with upload file at form doSave(). It is wired for embedded form with upload file. but I use the doSave() to deal with, it works, but I don't think it is good solution. Good luck On Jul 4, 4:13 pm, jmaicher wrote: > Hey! > > I've been spending hours and hours to find a way to upload a file in > an embedded form. But I couldn't find a solution yet. :-( > It seems to be a common bug and there is already a ticket (http:// > trac.symfony-project.org/ticket/6662). But I don't use doctrine forms. > I tried everything, including the workaround > onhttp://stereointeractive.com/blog/2008/12/23/symfony-12-upload-a-file > Unfortunately with no success. > > Please, do you guys have any suggestions for me?! > > Here is my form: > > class JobForm extends sfForm > { > public function JobForm() > { > ... > $this->embedForm("step2", new JobForm_Step2()); > ... > } > > } > > class JobForm_Step2 extends sfForm > { > > public function configure() > { > ... > > $this->setWidget("image", new sfWidgetFormInputFile()); > > # define validator for image > $configData = sfConfig::get("app_job_image"); > > $this->setValidator("image", new sfValidatorFile(array( > "required" => false, > "path" => sfConfig::get('sf_upload_dir') . $configData > ['upload_dir'] , > "mime_types" => array('image/jpeg', 'image/jpg'), > "max_size" => $configData['max_size'] * 1024 > ), array( > "mime_types" => "Es werden nur Bilder im JPEG-Dateiformat > unterstützt", > "max_size" => "Dein ausgewähltes Bild ist zu groß (maximal ". > $configData['max_size']." Kilobyte)" > ))); > ... > } > > } > > Here is my action: > ... > $this->form->bind($request->getParameter($this->form->getName()), > $request->getFiles($this->form->getName())); > ... > if(!$this->form['step2']['image']->hasError() && is_object($this->form > ['step2']['image']->getValue())) > { > # upload > > } > > $this->form['step2']['image']->getValue() is always NULL. Furthermore > $request->getFiles($this->form->getName()) is empty. How can that be?? > The $_FILES array is not empty, so the files has been correctly sent > to the server. > > I could really need some help here! Thanks, > > Julian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] The form with file uploading and embedden form is very wired for persisent object.
Hi, I create a form with one embedded form and one upload file field at the main form, at the same time, I need to change the validation for the embedded form. I use the sfShop Open source. I tried to use the address_book plugin. they use the "state_id" and "state_title" based on the country whether has the states listing. Then I met the troubles for saving object , updating object and uploading file, it spent my many hours to make them work together. My ProfileForm.class.php : class ProfileForm extends BaseProfileForm { protected $member_id; public function configure() { //parent::configure(); $this->member_id = sfContext::getInstance()->getUser()->getUserId (); $arrayCategories = array(); $categories = CategoryPeer::getAllPublic(); if ($categories !== null) { $arrayCategories[] = ' - Select category - '; foreach ($categories as $category) { array_push($arrayCategories, $category); } } $this->setWidgets( array( 'title' => new sfWidgetFormInput(), 'logo_path' => new sfWidgetFormInputFile ( array('label' => 'Company logo', )), ) ); $this->validatorSchema['category_id'] = new sfValidatorPropelChoice (array ('model' => 'category', 'column' => 'id', 'required' => true) ); $this->widgetSchema->setLabels(array( 'category_id'=> 'Category', 'message'=> 'Weclome Message', 'announcement' => 'Ads Details', )); $this->validatorSchema['logo_path'] = new sfValidatorFile(array( 'required' => true, 'path' => sfConfig::get('sf_upload_dir').'/logo/', 'mime_types' => 'web_images', )); $address_book = $this->getObject()->getAddressBook(); $address_book_form = new ProfileAddressBookForm($address_book); $this->embedForm('address', $address_book_form); $this->getWidgetSchema()->setNameFormat('data[%s]'); $this->defineSfsListFormatter(); $this->validatorSchema->setOption('allow_extra_fields', true); $this->validatorSchema->setOption('filter_extra_fields', false); } public function bind(array $taintedValues = null, array $taintedFiles = null) { // $ret = parent::bind($taintedValues, $taintedFiles); // If I uncomment it, It will call the sfValidation of "state_title" or "state_id" is invalid. if (isset($taintedValues['address']['country_has_states']) && $taintedValues['address']['country_has_states'] == 1) { unset($this->validatorSchema["address"]['state_title']); } else if(isset($taintedValues['address']['country_has_states'])) { // unset($taintedValues['address']['state_id']); unset($this->validatorSchema["address"]['state_id']); } $ret = parent::bind($taintedValues, $taintedFiles); // If I put parent:bind at here, the validation behavious is ok. return $ret; } protected function doSave($con = null) { $file = $this->getValue('logo_path'); if(is_object($file)) { if (file_exists($this->getObject()->getLogoPath())) { unlink($this->getObject()->getLogoPath()); } $filename = sha1($file->getOriginalName()).$file->getExtension ($file->getOriginalExtension()); $file->save(sfConfig::get('sf_upload_dir').'/logo/'.$filename); //echo $filename; $this->getObject()->setLogoPath($filename); } //$this->getObject()->save(); // this isn't work to save object to database //return parent::doSave($con); // this isn't still work to save object to database } } At my actioin class : public function executeEdit(sfWebRequest $request) { $member_id = $this->getUser()->getUserId(); $this->profile = $this->getOrCreateMemberProfile($member_id); $this->form = new ProfileForm($this->profile); if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName ()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $this->form->save(); // this only trigger doSave() at form file. $this->profile = $this->form->updateObject($request- >getParameter($this->form->getName())); $this->profile->save(); // for saving the profile object with address_book object to database. $this->redirect('@profile?action=show'); } } } I hope some one can hope me to figure out why I need to save the object twice time. It took my many time to figure out how it work. but it must be improved . Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options
[symfony-users] Re: Firebug lite
Hi, I think the esay way that would be to use the PHP condition check for envirment at the config file of view.yml. Oliver On Jun 28, 10:45 pm, Sid Bachtiar wrote: > Hi, > > Is there an easy way (like through view.yml) that I can include a > javascript file (for example firebug lite) only for dev > (frontend_dev.php)? > > Or may be someone can give me a suggestion on the best way to include > firebug lite in a symfony project? > > Thank you > > Regards, > > Sid > -- > Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: How to install sfAssetsLibraryPlugin properly?
Hi, Under the help of Alecs. I found this Plugins require the sfPropelActAsNestedSetBehaviorPlugin And at the same time, I fixed the save() , delete() for sfAssetFolder.php and delete() for sfAsset.php Do the following changes: public function save($con = null) => public function save (PropelPDO $con = null) Then I can use it is working now. Oliver On Jun 26, 11:03 am, happy oliver wrote: > Hi, everyone. > > 1. I check out the codes from svn /trunk. > 2. copy to the folder of plugins under my project > 3. run "symfony plugin:publish-assets". > 4. run the sql at the database to create the two tables > 5. make some setting at app.yml , create the subfolder of "meida" > under the folder of "web" > > but when I ran "symfony propel:build-all-load --env=dev ..." in order > to rebuid my system. > > At the first time, I change the folder.class.php > but I got the Fail Error Plugin form actasnestedset is not registered > > How to fix this problem? > > I saw the article said to run the propel:build-all , propel:data-load > differently. Is it right? > > Are there anyone who give me some suggestions. > > Are there some useful plugins for manipulating the images for one > persistent object? > I use the symfony 1.2.8-DEV and Propel version. > > Thanks for any helps. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] How to install sfAssetsLibraryPlugin properly?
Hi, everyone. 1. I check out the codes from svn /trunk. 2. copy to the folder of plugins under my project 3. run "symfony plugin:publish-assets". 4. run the sql at the database to create the two tables 5. make some setting at app.yml , create the subfolder of "meida" under the folder of "web" but when I ran "symfony propel:build-all-load --env=dev ..." in order to rebuid my system. At the first time, I change the folder.class.php but I got the Fail Error Plugin form actasnestedset is not registered How to fix this problem? I saw the article said to run the propel:build-all , propel:data-load differently. Is it right? Are there anyone who give me some suggestions. Are there some useful plugins for manipulating the images for one persistent object? I use the symfony 1.2.8-DEV and Propel version. Thanks for any helps. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Need helps, why my layout missed at prod envirnment ?
The problem is I cannot the use the sfWidgetFormPropelChoice for the prod. It maybe has some bugs. Oliver On Jun 21, 7:41 pm, happy oliver wrote: > On Jun 20, 4:00 pm, Alexandru-Emil Lupu wrote: > > > > > ** switch to the dev engine and you will see the error > > ...http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit > > > the layout does not loads because you may have an error somehow :) > > <http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit>Alecs > > > On Sat, Jun 20, 2009 at 12:25 PM, happy oliver wrote: > > > > Hi, everyone, > > > > At this page, I embedded the other form. > > > > Dose it caused the layout miss or not? > > > > Need helps. > > > > Thanks in advance. > > > > On Jun 20, 1:50 am, happy oliver wrote: > > > > Hi, Everyone, > > > > > Can you help me to figure out why my pages missed the layout at prod > > > > envirnemnt? > > > > > When I use "symfony cc", the layout for some pages show up only one > > > > time at prod env, when I refresh my page. the layout is gone? > > > > > How do I control it? > > > > > You can see this at my dev server > > > > >http://web.homecareerexpo.com > > > > > you can login use the following account: > > > > > user name: oli...@test.com > > > > > password: test > > > > > When you login , you can see the following page: > > > > >http://web.homecareerexpo.com/en/advertise/edit > > > > > the layout is missing. > > > > > Please help me. Thank you very much. > > > -- > > I am on twitter:http://twitter.com/alecslupu > > I am on linkedIn:http://www.linkedin.com/in/alecslupu > > Tel: (+4)0748.543.798- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Need helps, why my layout missed at prod envirnment ?
On Jun 20, 4:00 pm, Alexandru-Emil Lupu wrote: > ** switch to the dev engine and you will see the error > ...http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit > > the layout does not loads because you may have an error somehow :) > <http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit>Alecs > > On Sat, Jun 20, 2009 at 12:25 PM, happy oliver wrote: > > > Hi, everyone, > > > At this page, I embedded the other form. > > > Dose it caused the layout miss or not? > > > Need helps. > > > Thanks in advance. > > > On Jun 20, 1:50 am, happy oliver wrote: > > > Hi, Everyone, > > > > Can you help me to figure out why my pages missed the layout at prod > > > envirnemnt? > > > > When I use "symfony cc", the layout for some pages show up only one > > > time at prod env, when I refresh my page. the layout is gone? > > > > How do I control it? > > > > You can see this at my dev server > > > >http://web.homecareerexpo.com > > > > you can login use the following account: > > > > user name: oli...@test.com > > > > password: test > > > > When you login , you can see the following page: > > > >http://web.homecareerexpo.com/en/advertise/edit > > > > the layout is missing. > > > > Please help me. Thank you very much. > > -- > I am on twitter:http://twitter.com/alecslupu > I am on linkedIn:http://www.linkedin.com/in/alecslupu > Tel: (+4)0748.543.798- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Need helps, why my layout missed at prod envirnment ?
On Jun 20, 4:00 pm, Alexandru-Emil Lupu wrote: > ** switch to the dev engine and you will see the error > ...http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit > > the layout does not loads because you may have an error somehow :) > <http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit>Alecs > > On Sat, Jun 20, 2009 at 12:25 PM, happy oliver wrote: > > > > > > > > > Hi, everyone, > > > At this page, I embedded the other form. > > > Dose it caused the layout miss or not? > > > Need helps. > > > Thanks in advance. > > > On Jun 20, 1:50 am, happy oliver wrote: > > > Hi, Everyone, > > > > Can you help me to figure out why my pages missed the layout at prod > > > envirnemnt? > > > > When I use "symfony cc", the layout for some pages show up only one > > > time at prod env, when I refresh my page. the layout is gone? > > > > How do I control it? > > > > You can see this at my dev server > > > >http://web.homecareerexpo.com > > > > you can login use the following account: > > > > user name: oli...@test.com > > > > password: test > > > > When you login , you can see the following page: > > > >http://web.homecareerexpo.com/en/advertise/edit > > > > the layout is missing. > > > > Please help me. Thank you very much. > > -- > I am on twitter:http://twitter.com/alecslupu > I am on linkedIn:http://www.linkedin.com/in/alecslupu > Tel: (+4)0748.543.798- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Need helps, why my layout missed at prod envirnment ?
Hi, Thanks for Alecs' kindly helps. The following is his solution. hi! I have fixed the "category_id" issue, however, i think it should be polished a little bit. To make the modifications, in lib/form/AdvertisementForm.class.php replace the configure method with this : public function configure() { parent::configure(); $this->offsetUnset('advertisement2photo_list'); $criteria = new Criteria(); $temp_categories = CategoryPeer::doSelect($criteria); $categories = array(' Select category '); foreach($temp_categories as $category){ array_push($categories,$category); } $this->setWidgets( array( 'title' => new sfWidgetFormInput(), 'category_id' => new sfWidgetFormSelect(array( 'choices' => $categories )), 'logo_path' => new sfWidgetFormInputFile ( array('label' => 'Company logo', )), 'message' => new sfWidgetFormTextarea(), 'description' => new sfWidgetFormTextarea (), . ) ); $this->validatorSchema['category_id'] = new sfValidatorPropelChoice (array ('model' => 'category', 'column' => 'id', 'required' => true) ); $this->widgetSchema->setLabels(array( 'category_id'=> 'Category', 'message'=> 'Weclome Message', 'announcement' => 'Ads Details', )); $this->validatorSchema['logo_path'] = new sfValidatorFile(array( 'required' => false, // 'path' => sfConfig::get('sf_upload_dir').'/ads/', 'mime_types' => 'web_images', )); $this->getWidgetSchema()->setNameFormat('data[%s]'); $this->defineSfsListFormatter(); } basically i have removed the "sfpropelChoiceWidget" or whatever with a normal select widget, and also i have added this. $criteria = new Criteria(); $temp_categories = CategoryPeer::doSelect($criteria); $categories = array(' Select category '); foreach($temp_categories as $category){ array_push($categories,$category); } Alecs On Jun 20, 4:00 pm, Alexandru-Emil Lupu wrote: > ** switch to the dev engine and you will see the error > ...http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit > > the layout does not loads because you may have an error somehow :) > <http://web.homecareerexpo.com/frontend_dev.php/en/advertise/edit>Alecs > > On Sat, Jun 20, 2009 at 12:25 PM, happy oliver wrote: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Why do some fields of form not be saved into database properly?
Hi, everyone, I viewed the eshop codes. I saw the codes in sfsAddressBookPlugin -> modules->addressBook- >BaseAddressBookActions.class.php /** * Edit address action. * * @param void * @return void * @author Dmitry Nesteruk * @access public */ public function executeEdit($request) { sfLoader::loadHelpers('I18N'); $sfUser = $this->getUser(); $address = $this->getAddressOrCreate(); $this->form = new AddressBookForm($address); if ($request->isMethod('post')) { $data = $request->getParameter('data'); $this->form->bind($data); if ($this->form->isValid()) { $address = $this->form->updateObject(); $address->setCompany($data['company']); if (isset($data['is_default'])) { $address->setIsDefault(true); } else { $address->setIsDefault(false); } $address->save(); . At the AddressBookForm class AddressBookForm extends BaseAddressBookForm { public function configure() { $criteria = new Criteria(); CountryPeer::addPublicCriteria($criteria); $arrayCountries = CountryPeer::getHash($criteria); $arrayCountriesWidget = array(); $arrayCountriesWidget[] = ''; foreach ($arrayCountries as $key => $title) { $arrayCountriesWidget[$key] = $title; } $this->setWidgets( array( 'first_name' => new sfWidgetFormInput(), 'last_name' => new sfWidgetFormInput(), 'company'=> new sfWidgetFormInput(), .. The company exists at the form. Why must set the value for the field of "company" again? I run a test, If I don't use $address->setCompany(), then the company value cannot save into database. Can you help me this? I think it is very helpful to understand symfony. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: why do my include_partial not show slot content at prod env , but at dev env it is ok.
Hi, Alecs, Thanks for your helpful reply. I only want to show the simply submenu at some module pages. I use the partial that include my slot defination. Do you mean the slot cannot embedded at the partial part? The slot is working only for the layout? It is working at Dev env, but it doesn't work at Prod env. What the main difference between prod and dev for renderring the layout and template? Thanks you. Oliver On Jun 20, 3:40 pm, Alexandru-Emil Lupu wrote: > Maybe you might > readhttp://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer > > <http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer>and see > the real way to use the slots. What have you done, is not a slot, is a > partial. if you are not familiar with slots usage, you might get stick to > partials and components. > > Alecs > > On Sat, Jun 20, 2009 at 10:50 AM, happy oliver wrote: > > > > > > > > > Hi, > > > I created one partials that include one slot definiation. > > > _sub_menus_slot.php > > > > > Edit > > | > > Preview > a> > > | > > getIsPublished()) :?> > > Disable > a> > > > > Publish > a> > > > > > > > then , I use > => $advertisement));?> > > to show my sub menu at some template pages. > > > At the dev env, it is working well. > > > but when I run it at prod env, the sub menu doesn't show up. > > > Can someone help me to figure out the setting? > > > Thanks in advance. > > -- > I am on twitter:http://twitter.com/alecslupu > I am on linkedIn:http://www.linkedin.com/in/alecslupu > Tel: (+4)0748.543.798- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Need helps, why my layout missed at prod envirnment ?
Hi, everyone, At this page, I embedded the other form. Dose it caused the layout miss or not? Need helps. Thanks in advance. On Jun 20, 1:50 am, happy oliver wrote: > Hi, Everyone, > > Can you help me to figure out why my pages missed the layout at prod > envirnemnt? > > When I use "symfony cc", the layout for some pages show up only one > time at prod env, when I refresh my page. the layout is gone? > > How do I control it? > > You can see this at my dev server > > http://web.homecareerexpo.com > > you can login use the following account: > > user name: oli...@test.com > > password: test > > When you login , you can see the following page: > > http://web.homecareerexpo.com/en/advertise/edit > > the layout is missing. > > Please help me. Thank you very much. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Need helps, why my layout missed at prod envirnment ?
Hi, Everyone, Can you help me to figure out why my pages missed the layout at prod envirnemnt? When I use "symfony cc", the layout for some pages show up only one time at prod env, when I refresh my page. the layout is gone? How do I control it? You can see this at my dev server http://web.homecareerexpo.com you can login use the following account: user name: oli...@test.com password: test When you login , you can see the following page: http://web.homecareerexpo.com/en/advertise/edit the layout is missing. Please help me. Thank you very much. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Why cannot I save the uploaded file name to database automatically?
I found the form fields are disabled by the FF block items. Could someone help me for my questions? Thanks in advance. On Jun 18, 11:56 pm, happy oliver wrote: > Hi, > > Are there someone can point out why I cannot save the upload file path > into database by default. > > I customize my form showing as below. > > At the Form class: > class AdvertisementForm extends BaseAdvertisementForm > { > public function configure() > { > > parent::configure(); > $this->offsetUnset('advertisement2photo_list'); > > $this->setWidgets( > array( > 'title' => new sfWidgetFormInput(), > 'category_id' => new > sfWidgetFormPropelChoice( > array('model' => > 'category', > 'add_empty' > => ' Select category ', > )), > 'logo_path' => new sfWidgetFormInputFile > ( > array('label' => > 'Company logo', > )), > 'message' => new sfWidgetFormInput() > ) > ); > > $this->validatorSchema['category_id'] = new sfValidatorPropelChoice > (array > ('model' => 'category', 'column' => 'id', 'required' => true) > ); > > $this->widgetSchema->setLabels(array( > 'category_id' => 'Category', > 'message' => 'Weclome Message', > 'announcement' => 'Ads Details', > )); > > $this->validatorSchema['logo_path'] = new sfValidatorFile(array( > 'required' => false, > 'path' => sfConfig::get('sf_upload_dir').'/ads/', > 'mime_types' => 'web_images', > )); > > $this->getWidgetSchema()->setNameFormat('data[%s]'); > $this->defineSfsListFormatter(); > > } > > protected function doSave($con = null) > { > > if (file_exists($this->getObject()->getLogoPath())) > { > unlink($this->getObject()->getLogoPath()); > } > return parent::doSave($con); > } > > At the action class: > > protected function processForm(sfWebRequest $request, sfForm $form) > { > /* bind, validate and save form */ > $form->bind($request->getParameter($form->getName()), > $request->getFiles($form->getName())); > > if ($form->isValid()) > { > $advertisement = $form->save(); > $this->redirect('@advertise?action=show'); > } > } > > When I used the above code, I saw the file was uploaded to the web > folder, the database logo_path field is empty. > > I don't know why it don't save the absoluted file path to database. > > When I modified the function of doSave() > > protected function doSave($con = null) > { > if (file_exists($this->getObject()->getLogoPath())) > { > unlink($this->getObject()->getLogoPath()); > } > > $file = $this->getValue('logo_path'); > $filename = sha1($file->getOriginalName()).$file->getExtension > ($file->getOriginalExtension()); > $file->save(sfConfig::get('sf_upload_dir').'/ads/'.$filename); > $this->getObject()->setLogoPath($filename); > $this->getObject()->save(); > return parent::doSave($con); > } > > Then , I saw the file path had been saved into database. > > Can someone point my code's problem? > > By the way , I must mention one issue I met it is very wired. > > When I use the > $this->getWidgetSchema()->setNameFormat('advertisement[%s]'); > > At the Firefox 2.0.0.20. the form fields cannot been show up. At the > IE 7, the form fields is normal. > > so I must change the form name format to > > $this->getWidgetSchema()->setNameFormat('data[%s]'); > > It spent my several hours to figure out. I think there are some > forbidden words in Firefox. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] why do my include_partial not show slot content at prod env , but at dev env it is ok.
Hi, I created one partials that include one slot definiation. _sub_menus_slot.php Edit | Preview | getIsPublished()) :?> Disable Publish then , I use $advertisement));?> to show my sub menu at some template pages. At the dev env, it is working well. but when I run it at prod env, the sub menu doesn't show up. Can someone help me to figure out the setting? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Why cannot I save the uploaded file name to database automatically?
Hi, Are there someone can point out why I cannot save the upload file path into database by default. I customize my form showing as below. At the Form class: class AdvertisementForm extends BaseAdvertisementForm { public function configure() { parent::configure(); $this->offsetUnset('advertisement2photo_list'); $this->setWidgets( array( 'title' => new sfWidgetFormInput(), 'category_id' => new sfWidgetFormPropelChoice( array('model' => 'category', 'add_empty' => ' Select category ', )), 'logo_path' => new sfWidgetFormInputFile ( array('label' => 'Company logo', )), 'message' => new sfWidgetFormInput() ) ); $this->validatorSchema['category_id'] = new sfValidatorPropelChoice (array ('model' => 'category', 'column' => 'id', 'required' => true) ); $this->widgetSchema->setLabels(array( 'category_id'=> 'Category', 'message'=> 'Weclome Message', 'announcement' => 'Ads Details', )); $this->validatorSchema['logo_path'] = new sfValidatorFile(array( 'required' => false, 'path' => sfConfig::get('sf_upload_dir').'/ads/', 'mime_types' => 'web_images', )); $this->getWidgetSchema()->setNameFormat('data[%s]'); $this->defineSfsListFormatter(); } protected function doSave($con = null) { if (file_exists($this->getObject()->getLogoPath())) { unlink($this->getObject()->getLogoPath()); } return parent::doSave($con); } At the action class: protected function processForm(sfWebRequest $request, sfForm $form) { /* bind, validate and save form */ $form->bind($request->getParameter($form->getName()), $request- >getFiles($form->getName())); if ($form->isValid()) { $advertisement = $form->save(); $this->redirect('@advertise?action=show'); } } When I used the above code, I saw the file was uploaded to the web folder, the database logo_path field is empty. I don't know why it don't save the absoluted file path to database. When I modified the function of doSave() protected function doSave($con = null) { if (file_exists($this->getObject()->getLogoPath())) { unlink($this->getObject()->getLogoPath()); } $file = $this->getValue('logo_path'); $filename = sha1($file->getOriginalName()).$file->getExtension ($file->getOriginalExtension()); $file->save(sfConfig::get('sf_upload_dir').'/ads/'.$filename); $this->getObject()->setLogoPath($filename); $this->getObject()->save(); return parent::doSave($con); } Then , I saw the file path had been saved into database. Can someone point my code's problem? By the way , I must mention one issue I met it is very wired. When I use the $this->getWidgetSchema()->setNameFormat('advertisement[%s]'); At the Firefox 2.0.0.20. the form fields cannot been show up. At the IE 7, the form fields is normal. so I must change the form name format to $this->getWidgetSchema()->setNameFormat('data[%s]'); It spent my several hours to figure out. I think there are some forbidden words in Firefox. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] How to clear the stale value after using the AJAX.
First I say thanks to Francois Zaninotto http://www.sitepoint.com/article/symfony-beginners-tutorial/6/ I want to know how to clear the stale value after using the AJAX. At the above article, when I used the AJAX to submit the comment for the photo, the second click the "add the comment". the form was filled with the old data. How to clear it? At the same time, when I put the " " within the ' ' the link of link_to_function for "add a comment" will disappear after submitting the comment. and I also found when I don't use "use_helper('Form')" for "input_hidden_tag" at the templete file of photoSuccess, symfony render system will lost the layout before rendering the page without any message. Is it true? I need helps. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---