Author: fizyk
Date: 2010-04-13 22:13:09 +0200 (Tue, 13 Apr 2010)
New Revision: 29127
Modified:
plugins/vjCommentPlugin/TRUNK/lib/form/doctrine/PluginCommentForm.class.php
plugins/vjCommentPlugin/TRUNK/modules/comment/lib/BaseCommentComponents.class.php
plugins/vjCommentPlugin/TRUNK/modules/comment/templates/_formComment.php
plugins/vjCommentPlugin/TRUNK/package.xml.tmpl
Log:
changed conditions in templates, form and component to use new vjComment class
Modified:
plugins/vjCommentPlugin/TRUNK/lib/form/doctrine/PluginCommentForm.class.php
===================================================================
--- plugins/vjCommentPlugin/TRUNK/lib/form/doctrine/PluginCommentForm.class.php
2010-04-13 20:09:31 UTC (rev 29126)
+++ plugins/vjCommentPlugin/TRUNK/lib/form/doctrine/PluginCommentForm.class.php
2010-04-13 20:13:09 UTC (rev 29127)
@@ -21,7 +21,7 @@
$this->widgetSchema->setHelp('author_email', __('Your email will never be
published', array(), 'vjComment'));
$this->widgetSchema['user_id'] = new sfWidgetFormInputHidden();
- if( $this->isLoginRestricted() ||
sfContext::getInstance()->getUser()->isAuthenticated() )
+ if( vjComment::isUserBoundAndAuthenticated() )
{
unset( $this['author_email'], $this['author_website'],
$this['author_name'] );
}
@@ -29,14 +29,13 @@
{
unset( $this['user_id'] );
}
-
- if ($this->isCaptchaEnabled() &&
!sfContext::getInstance()->getUser()->isAuthenticated() )
+ if (vjComment::isCaptchaEnabled() &&
!vjComment::isUserBoundAndAuthenticated() )
{
$this->addCaptcha();
}
}
- public function addCaptcha()
+ protected function addCaptcha()
{
$this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array(
'public_key' => sfConfig::get('app_recaptcha_public_key')
@@ -49,14 +48,4 @@
->setMessage('captcha', __('The captcha is not valid (%error%).',
array(), 'vjComment'))
->setMessage('server_problem', __('Unable to check the captcha from
the server (%error%).', array(), 'vjComment'));
}
-
- public function isCaptchaEnabled()
- {
- return sfConfig::get('app_recaptcha_enabled');
- }
-
- private function isLoginRestricted()
- {
- return sfConfig::get('app_vjCommentPlugin_restricted');
- }
}
\ No newline at end of file
Modified:
plugins/vjCommentPlugin/TRUNK/modules/comment/lib/BaseCommentComponents.class.php
===================================================================
---
plugins/vjCommentPlugin/TRUNK/modules/comment/lib/BaseCommentComponents.class.php
2010-04-13 20:09:31 UTC (rev 29126)
+++
plugins/vjCommentPlugin/TRUNK/modules/comment/lib/BaseCommentComponents.class.php
2010-04-13 20:13:09 UTC (rev 29127)
@@ -21,10 +21,7 @@
//preparing temporary array with sent values
$formValues = $request->getParameter($this->form->getName());
- //TODO! Review this conditions:
- //1. captcha should be enabled
- //2. if sfGuardUser bound on, user should not be authenticated
- if(sfConfig::get('app_recaptcha_enabled') &&
$this->getUser()->isAuthenticated() )
+ if( vjComment::isCaptchaEnabled() &&
!vjComment::isUserBoundAndAuthenticated() )
{
$captcha = array(
'recaptcha_challenge_field' =>
$request->getParameter('recaptcha_challenge_field'),
@@ -33,7 +30,7 @@
//Adding captcha
$formValues = array_merge( $formValues, array('captcha' => $captcha)
);
}
- if( sfConfig::get('app_vjCommentPlugin_restricted', false) ||
$this->getUser()->isAuthenticated() )
+ if( vjComment::isUserBoundAndAuthenticated() )
{
//adding user id
$formValues = array_merge( $formValues, array('user_id' =>
$this->getUser()->getGuardUser()->getId() ) );
Modified:
plugins/vjCommentPlugin/TRUNK/modules/comment/templates/_formComment.php
===================================================================
--- plugins/vjCommentPlugin/TRUNK/modules/comment/templates/_formComment.php
2010-04-13 20:09:31 UTC (rev 29126)
+++ plugins/vjCommentPlugin/TRUNK/modules/comment/templates/_formComment.php
2010-04-13 20:13:09 UTC (rev 29127)
@@ -4,7 +4,7 @@
<?php $sf_user->setAttribute('nextComment', $object->getNbComments()+1) ?>
<a name="top"></a>
<div class="form-comment">
-<?php if( sfConfig::get( 'app_vjCommentPlugin_restricted' ) &&
$sf_user->isAuthenticated() || !sfConfig::get( 'app_vjCommentPlugin_restricted'
) ): ?>
+<?php if( vjComment::checkAccessToForm() ): ?>
<form action="" method="post">
<fieldset>
<legend><?php echo __('Add new comment', array(), 'vjComment') ?></legend>
Modified: plugins/vjCommentPlugin/TRUNK/package.xml.tmpl
===================================================================
--- plugins/vjCommentPlugin/TRUNK/package.xml.tmpl 2010-04-13 20:09:31 UTC
(rev 29126)
+++ plugins/vjCommentPlugin/TRUNK/package.xml.tmpl 2010-04-13 20:13:09 UTC
(rev 29127)
@@ -62,12 +62,14 @@
<date>2010-04-12</date>
<license>MIT</license>
<notes>
+ * fizyk: changed conditions in templates, form and component to use
new vjComment class
+ * fizyk: added class with static method to handle common check
conditions
+ * jp_morvan: remove report link when comment is already deleted
+ * jp_morvan: remove author name, email and website from adminComment's
edit and reply when sfGuardUser's model used
+ * jp_morvan: add username from adminComment's edit and reply when
sfGuardUser's model used
* fizyk: added setting that allows adding relation bewteen comment and
sfGuardUser, so it will no longer be mandatory to use sfGuardUser.
* fizyk: integrated functionality to make use of sfGuardUser
* fizyk: added relation to sfGuardUser
- * jp_morvan: remove report link when comment is already deleted
- * jp_morvan: remove author name, email and website from adminComment's
edit and reply when sfGuardUser's model used
- * jp_morvan: add username from adminComment's edit and reply when
sfGuardUser's model used
</notes>
</release>
<release>
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.