Author: tkoomzaaskz
Date: 2010-01-24 14:36:13 +0100 (Sun, 24 Jan 2010)
New Revision: 27123
Added:
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/tdFrontendGuestbookForm.class.php
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/i18n/
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/i18n/td.pl.xml
Removed:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/_form.php
Modified:
plugins/tdGuestbookPlugin/trunk/README
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/actions/actions.class.php
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/indexSuccess.php
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/newSuccess.php
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/config/generator.yml
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorConfiguration.class.php
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorHelper.class.php
plugins/tdGuestbookPlugin/trunk/package.xml
Log:
[td][guestbook crypto captcha support added
Modified: plugins/tdGuestbookPlugin/trunk/README
===================================================================
--- plugins/tdGuestbookPlugin/trunk/README 2010-01-24 13:09:30 UTC (rev
27122)
+++ plugins/tdGuestbookPlugin/trunk/README 2010-01-24 13:36:13 UTC (rev
27123)
@@ -53,6 +53,10 @@
[php]
enabled_modules: [ ..., td_guestbook ]
+ * tdSampleGuestbook uses sfCryptoCaptchaPlugin to generate captcha images. A
+ special class with captcha configuration is included:
_tdFrontendGuestbookForm_.
+ td_guestbook admin module uses the standard tdGuestbookForm.
+
Configuration
=============
@@ -77,3 +81,4 @@
============
* [tdCorePlugin](http://www.symfony-project.org/plugins/tdCorePlugin)
+ *
[sfCryptoCaptchaPlugin](http://www.symfony-project.org/plugins/sfCryptoCaptchaPlugin)
Modified:
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
2010-01-24 13:09:30 UTC (rev 27122)
+++
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -16,7 +16,11 @@
$this->removeFields();
+ $this->manageWidgets();
+
$this->manageValidators();
+
+// $this->manageCaptcha();
}
protected function removeFields()
@@ -24,6 +28,14 @@
unset($this['created_at'], $this['updated_at']);
}
+ protected function manageWidgets()
+ {
+ $this->setWidget('author', new sfWidgetFormInputText(array(), array('size'
=> '30')));
+ $this->setWidget('email', new sfWidgetFormInputText(array(), array('size'
=> '30')));
+ $this->setWidget('http', new sfWidgetFormInputText(array(), array('size'
=> '30')));
+ $this->setWidget('text', new sfWidgetFormTextarea(array(), array('cols' =>
'80', 'rows' => '8')));
+ }
+
protected function manageValidators()
{
$this->setValidator('author',
@@ -31,5 +43,22 @@
$this->setValidator('text',
new sfValidatorString(array(), array('required' => 'Musisz podać
treść.')));
+
+ $this->setValidator('email',
+ new sfValidatorEmail(array('required' => false), array('invalid' =>
'Wpisz poprawny adres E-mail.')));
}
+
+ protected function manageCaptcha()
+ {
+ $this->setWidget('captcha', new sfWidgetFormInput(array(), array('size' =>
'30')));
+
+ $this->widgetSchema->setLabel('captcha', 'Wpisz kod z obrazka');
+
+ $this->setValidator('captcha', new sfValidatorSfCryptoCaptcha(
+ array('required' => true, 'trim' => true),
+ array('wrong_captcha' => 'Kod który wpisałeś jest niepoprawny.',
+ 'required' => 'Musisz wpisać kod z obrazka poniżej.')));
+
+ $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
+ }
}
Added:
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/tdFrontendGuestbookForm.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/tdFrontendGuestbookForm.class.php
(rev 0)
+++
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/tdFrontendGuestbookForm.class.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * tdFrontendGuestbook form.
+ *
+ * @package tdGuestbookPlugin
+ * @subpackage form
+ * @author Tomasz Ducin <[email protected]>
+ * @version SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12
11:07:44Z Kris.Wallsmith $
+ */
+class tdFrontendGuestbookForm extends PlugintdGuestbookForm
+{
+ public function setup()
+ {
+ parent::setup();
+
+ $this->manageCaptcha();
+ }
+
+ protected function manageCaptcha()
+ {
+ $this->setWidget('captcha', new sfWidgetFormInput(array(), array('size' =>
'30')));
+
+ $this->widgetSchema->setLabel('captcha', 'Wpisz kod z obrazka');
+
+ $this->setValidator('captcha', new sfValidatorSfCryptoCaptcha(
+ array('required' => true, 'trim' => true),
+ array('wrong_captcha' => 'Kod który wpisałeś jest niepoprawny.',
+ 'required' => 'Musisz wpisać kod z obrazka poniżej.')));
+
+ $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
+ }
+}
Modified:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/actions/actions.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/actions/actions.class.php
2010-01-24 13:09:30 UTC (rev 27122)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/actions/actions.class.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -29,14 +29,14 @@
// ading default td_guestbook layout
$this->getResponse()->addStylesheet('/tdGuestbookPlugin/css/td_guestbook.css');
- $this->form = new tdGuestbookForm();
+ $this->form = new tdFrontendGuestbookForm();
}
public function executeCreate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST));
- $this->form = new tdGuestbookForm();
+ $this->form = new tdFrontendGuestbookForm();
$this->processForm($request, $this->form);
@@ -52,6 +52,7 @@
$guestbook->setActive(true);
$guestbook->save();
+ $this->getUser()->setFlash('notice', 'Thank you for submitting your
guestbook entry.');
$this->redirect('td_sample_guestbook');
}
}
Added: plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/i18n/td.pl.xml
===================================================================
--- plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/i18n/td.pl.xml
(rev 0)
+++ plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/i18n/td.pl.xml
2010-01-24 13:36:13 UTC (rev 27123)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN"
"http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" >
+<xliff version="1.0">
+ <file original="global" source-language="en" datatype="plaintext">
+ <header />
+ <body>
+ <trans-unit>
+ <source>Thank you for submitting your guestbook entry.</source>
+ <target>Dziękujemy za wpis w księdze gości.</target>
+ </trans-unit>
+ <trans-unit>
+ <source>Entry could not be added to the guestbook due to some
errors.</source>
+ <target>Wpis nie mógł zostać dodany do księgi gości z powodu
błędów</target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
Deleted:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/_form.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/_form.php
2010-01-24 13:09:30 UTC (rev 27122)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/_form.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -1,67 +0,0 @@
-<?php use_stylesheets_for_form($form) ?>
-<?php use_javascripts_for_form($form) ?>
-
-<form action="<?php echo url_for('guestbook/'.($form->getObject()->isNew() ?
'create' : 'update').(!$form->getObject()->isNew() ?
'?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php
$form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
-<?php if (!$form->getObject()->isNew()): ?>
-<input type="hidden" name="sf_method" value="put" />
-<?php endif; ?>
- <table>
- <tfoot>
- <tr>
- <td colspan="2">
- <?php echo $form->renderHiddenFields(false) ?>
- <a href="<?php echo url_for('guestbook/index') ?>">Back to
list</a>
- <?php if (!$form->getObject()->isNew()): ?>
- <?php echo link_to('Delete',
'guestbook/delete?id='.$form->getObject()->getId(), array('method' => 'delete',
'confirm' => 'Are you sure?')) ?>
- <?php endif; ?>
- <input type="submit" value="Save" />
- </td>
- </tr>
- </tfoot>
- <tbody>
- <?php echo $form->renderGlobalErrors() ?>
- <tr>
- <th><?php echo $form['author']->renderLabel() ?></th>
- <td>
- <?php echo $form['author']->renderError() ?>
- <?php echo $form['author'] ?>
- </td>
- </tr>
- <tr>
- <th><?php echo $form['email']->renderLabel() ?></th>
- <td>
- <?php echo $form['email']->renderError() ?>
- <?php echo $form['email'] ?>
- </td>
- </tr>
- <tr>
- <th><?php echo $form['http']->renderLabel() ?></th>
- <td>
- <?php echo $form['http']->renderError() ?>
- <?php echo $form['http'] ?>
- </td>
- </tr>
- <tr>
- <th><?php echo $form['text']->renderLabel() ?></th>
- <td>
- <?php echo $form['text']->renderError() ?>
- <?php echo $form['text'] ?>
- </td>
- </tr>
- <tr>
- <th><?php echo $form['created_at']->renderLabel() ?></th>
- <td>
- <?php echo $form['created_at']->renderError() ?>
- <?php echo $form['created_at'] ?>
- </td>
- </tr>
- <tr>
- <th><?php echo $form['updated_at']->renderLabel() ?></th>
- <td>
- <?php echo $form['updated_at']->renderError() ?>
- <?php echo $form['updated_at'] ?>
- </td>
- </tr>
- </tbody>
- </table>
-</form>
Modified:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/indexSuccess.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/indexSuccess.php
2010-01-24 13:09:30 UTC (rev 27122)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/indexSuccess.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -2,6 +2,10 @@
<h1>Księga gości</h1>
+<?php if ($sf_user->hasFlash('notice')): ?>
+ <h2><?php echo __($sf_user->getFlash('notice'), array(), 'td') ?></h2>
+<?php endif; ?>
+
<div class="special">
<a href="<?php echo url_for('@td_sample_guestbook_add') ?>">Wpisz się do
księgi gości</a>
</div>
Modified:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/newSuccess.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/newSuccess.php
2010-01-24 13:09:30 UTC (rev 27122)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/newSuccess.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -1,10 +1,20 @@
-<?php use_stylesheets_for_form($form) ?>
-<?php use_javascripts_for_form($form) ?>
+<?php
+use_helper('sfCryptoCaptcha', 'I18N');
+use_stylesheets_for_form($form);
+use_javascripts_for_form($form);
+captcha_image();
+captcha_reload_button();
+?>
<h1>Nowy wpis do Księgi Gości</h1>
<ul id="guestbook">
<li>
+
+<?php if ($form->hasErrors()): ?>
+ <h2 class="error"><?php echo __('Entry could not be added to the guestbook
due to some errors.', array(), 'td') ?></h2>
+<?php endif; ?>
+
<form action="<?php echo url_for('tdSampleGuestbook/create') ?>" method="post"
<?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
@@ -12,6 +22,7 @@
<table>
<tfoot>
<tr>
+ <th></th>
<td colspan="2">
<?php echo $form->renderHiddenFields(false) ?>
<a href="<?php echo url_for('@td_sample_guestbook')
?>">Anuluj</a>
@@ -49,6 +60,17 @@
<?php echo $form['text'] ?>
</td>
</tr>
+ <tr>
+ <th></th>
+ <td><?php echo captcha_image(); echo captcha_reload_button(); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo $form['captcha']->renderLabel(); ?></th>
+ <td>
+ <?php echo $form['captcha']->renderError(); ?>
+ <?php echo $form['captcha']->render(); ?>
+ </td>
+ </tr>
</tbody>
</table>
</form>
Modified:
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/config/generator.yml
===================================================================
--- plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/config/generator.yml
2010-01-24 13:09:30 UTC (rev 27122)
+++ plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/config/generator.yml
2010-01-24 13:36:13 UTC (rev 27123)
@@ -42,7 +42,7 @@
_delete: ~
activate: ~
deactivate: ~
- display: [ active, author, text, updated_at ]
+ display: [ active, author, text, updated_at, created_at ]
max_per_page: 10
layout: stacked
params: |
@@ -53,6 +53,7 @@
<strong>Utworzono</strong>: <i>%%created_at%%</i>
<br />
<strong>Zmieniono</strong>: <i>%%updated_at%%</i>
+ sort: created_at
filter: ~
form:
fields:
Modified:
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorConfiguration.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorConfiguration.class.php
2010-01-24 13:09:30 UTC (rev 27122)
+++
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorConfiguration.class.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -6,7 +6,6 @@
* @package tdGuestbookPlugin
* @subpackage backend
* @author Tomasz Ducin
- * @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z
Kris.Wallsmith $
*/
class td_guestbookGeneratorConfiguration extends
BaseTd_guestbookGeneratorConfiguration
{
Modified:
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorHelper.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorHelper.class.php
2010-01-24 13:09:30 UTC (rev 27122)
+++
plugins/tdGuestbookPlugin/trunk/modules/td_guestbook/lib/td_guestbookGeneratorHelper.class.php
2010-01-24 13:36:13 UTC (rev 27123)
@@ -6,7 +6,6 @@
* @package tdGuestbookPlugin
* @subpackage backend
* @author Tomasz Ducin <[email protected]>
- * @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class td_guestbookGeneratorHelper extends BaseTd_guestbookGeneratorHelper
{
Modified: plugins/tdGuestbookPlugin/trunk/package.xml
===================================================================
--- plugins/tdGuestbookPlugin/trunk/package.xml 2010-01-24 13:09:30 UTC (rev
27122)
+++ plugins/tdGuestbookPlugin/trunk/package.xml 2010-01-24 13:36:13 UTC (rev
27123)
@@ -13,7 +13,7 @@
<date>2010-01-24</date>
<time>11:00:00</time>
<version>
- <release>0.1.3</release>
+ <release>0.1.4</release>
<api>0.1.0</api>
</version>
<stability>
@@ -49,6 +49,7 @@
<dir name="form">
<dir name="doctrine">
<file name="PlugintdGuestbookForm.class.php" role="data" />
+ <file name="tdFrontendGuestbookForm.class.php" role="data" />
</dir>
</dir>
<dir name="model">
@@ -80,8 +81,10 @@
<dir name="actions">
<file name="actions.class.php" role="data" />
</dir>
+ <dir name="i18n">
+ <file name="td.pl.xml" role="data" />
+ </dir>
<dir name="templates">
- <file name="_form.php" role="data" />
<file name="indexSuccess.php" role="data" />
<file name="newSuccess.php" role="data" />
</dir>
@@ -117,8 +120,13 @@
<package>
<name>tdCorePlugin</name>
<channel>plugins.symfony-project.org</channel>
- <min>0.1.7</min>
+ <min>0.1.8</min>
</package>
+ <package>
+ <name>sfCryptoCaptchaPlugin</name>
+ <channel>plugins.symfony-project.org</channel>
+ <min>0.1.0</min>
+ </package>
</required>
</dependencies>
@@ -129,6 +137,25 @@
<release>
<version>
+ <release>0.1.4</release>
+ <api>0.1.0</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <license uri="http://www.symfony-project.org/license">MIT license</license>
+ <date>2010-01-24</date>
+ <license>MIT</license>
+ <notes>
+ * added crypto captcha support (dependency on sfCryptoCaptchaPlugin)
+ * added translations
+ * default sort in admin panel
+ </notes>
+ </release>
+
+ <release>
+ <version>
<release>0.1.3</release>
<api>0.1.0</api>
</version>
--
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.