Bug(バグ) #3588 » t-3588.patch
apps/mobile_frontend/modules/community/actions/actions.class.php | ||
---|---|---|
$this->redirect('community/configImage?id='.$this->id);
|
||
}
|
||
}
|
||
/**
|
||
* Executes edit action
|
||
*
|
||
* @param sfRequest $request A request object
|
||
*/
|
||
public function executeEdit(opWebRequest $request)
|
||
{
|
||
$this->unusedFileForm = true;
|
||
return parent::executeEdit($request);
|
||
}
|
||
}
|
lib/action/opCommunityAction.class.php | ||
---|---|---|
$this->communityForm = new CommunityForm($this->community);
|
||
$this->communityConfigForm = new CommunityConfigForm(array(), array('community' => $this->community));
|
||
if (!$this->unusedFileForm){$this->communityFileForm = new CommunityFileForm(array(), array('community' => $this->community));}
|
||
|
||
if ($request->isMethod('post'))
|
||
$this->communityFileForm = null;
|
||
if (!sfConfig::get('app_is_mobile', false))
|
||
{
|
||
$params = $request->getParameter('community');
|
||
$params['id'] = $this->id;
|
||
$this->communityForm->bind($params);
|
||
$this->communityConfigForm->bind($request->getParameter('community_config'));
|
||
if($this->communityFileForm)
|
||
{
|
||
$this->communityFileForm->bind($request->getParameter('community_file'), $request->getFiles('community_file'));
|
||
if ($this->communityForm->isValid() && $this->communityConfigForm->isValid() && $this->communityFileForm->isValid())
|
||
{
|
||
$this->communityForm->save();
|
||
$this->communityConfigForm->save();
|
||
$this->communityFileForm->save();
|
||
$this->communityFileForm = new CommunityFileForm(array(), array('community' => $this->community));
|
||
}
|
||
$this->redirect('@community_home?id='.$this->community->getId());
|
||
}
|
||
}
|
||
elseif ($this->communityForm->isValid() && $this->communityConfigForm->isValid())
|
||
{
|
||
$this->communityForm->save();
|
||
$this->communityConfigForm->save();
|
||
if ($request->isMethod(sfRequest::POST) && $this->processForms($this->communityForm, $this->communityConfigForm, $this->communityFileForm))
|
||
{
|
||
$this->redirect('@community_home?id='.$this->community->getId());
|
||
}
|
||
}
|
||
$this->redirect('@community_home?id='.$this->community->getId());
|
||
protected function processForms(CommunityForm $communityForm, CommunityConfigForm $communityConfigForm, CommunityFileForm $communityFileForm = null)
|
||
{
|
||
$request = $this->getRequest();
|
||
$forms = array($communityForm, $communityConfigForm);
|
||
if ($communityFileForm)
|
||
{
|
||
$forms[] = $communityFileForm;
|
||
}
|
||
$okCount = 0;
|
||
foreach ($forms as $form)
|
||
{
|
||
$name = $form->getName();
|
||
$form->bind($request->getParameter($name), $request->getFiles($name));
|
||
if ($form->isValid())
|
||
{
|
||
$okCount++;
|
||
}
|
||
}
|
||
if ($okCount !== count($forms))
|
||
{
|
||
return false;
|
||
}
|
||
foreach ($forms as $form)
|
||
{
|
||
$form->save();
|
||
}
|
||
return true;
|
||
}
|
||
/**
|