Author: tkoomzaaskz
Date: 2010-01-22 16:56:06 +0100 (Fri, 22 Jan 2010)
New Revision: 27056
Added:
plugins/tdGuestbookPlugin/trunk/web/
plugins/tdGuestbookPlugin/trunk/web/css/
plugins/tdGuestbookPlugin/trunk/web/css/td_guestbook.css
Removed:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/editSuccess.php
Modified:
plugins/tdGuestbookPlugin/trunk/README
plugins/tdGuestbookPlugin/trunk/config/routing.yml
plugins/tdGuestbookPlugin/trunk/data/fixtures/fixtures.yml
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
plugins/tdGuestbookPlugin/trunk/lib/model/doctrine/PlugintdGuestbookTable.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/package.xml
Log:
[td][guestbook] release 0.1.2
Modified: plugins/tdGuestbookPlugin/trunk/README
===================================================================
--- plugins/tdGuestbookPlugin/trunk/README 2010-01-22 15:53:37 UTC (rev
27055)
+++ plugins/tdGuestbookPlugin/trunk/README 2010-01-22 15:56:06 UTC (rev
27056)
@@ -17,8 +17,14 @@
$ ./symfony plugin:install -s beta tdGuestbookPlugin
-as the actual release is in its beta stage.
+as the actual release is in its beta stage. Right after the installation of the
+plugin, you should update plugin assets:
+ $ ./symfony plugin:publish-assets
+
+so that the predefined layout files of the plugin are accessible. Everything
+is done properly now.
+
Usage
=====
Modified: plugins/tdGuestbookPlugin/trunk/config/routing.yml
===================================================================
--- plugins/tdGuestbookPlugin/trunk/config/routing.yml 2010-01-22 15:53:37 UTC
(rev 27055)
+++ plugins/tdGuestbookPlugin/trunk/config/routing.yml 2010-01-22 15:56:06 UTC
(rev 27056)
@@ -2,6 +2,10 @@
url: /sample-guestbook
param: { module: tdSampleGuestbook, action: index }
+td_sample_guestbook_add:
+ url: /guestbook-add
+ param: { module: tdSampleGuestbook, action: new }
+
td_guestbook:
class: sfDoctrineRouteCollection
options:
Modified: plugins/tdGuestbookPlugin/trunk/data/fixtures/fixtures.yml
===================================================================
--- plugins/tdGuestbookPlugin/trunk/data/fixtures/fixtures.yml 2010-01-22
15:53:37 UTC (rev 27055)
+++ plugins/tdGuestbookPlugin/trunk/data/fixtures/fixtures.yml 2010-01-22
15:56:06 UTC (rev 27056)
@@ -10,4 +10,6 @@
http: <?php echo $generator->getRandomHttp()."\n" ?>
<?php endif; ?>
text: <?php echo
$generator->getRandomText(mt_rand(20,100)*mt_rand(1,5))."\n" ?>
-<?php endfor; ?>
\ No newline at end of file
+<?php endfor; ?>
+ created_at: <?php echo $time = $generator->getRandomCreatedAt(2000 +
mt_rand(1,9))."\n" ?>
+ updated_at: <?php echo $time ?>
Modified:
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
2010-01-22 15:53:37 UTC (rev 27055)
+++
plugins/tdGuestbookPlugin/trunk/lib/form/doctrine/PlugintdGuestbookForm.class.php
2010-01-22 15:56:06 UTC (rev 27056)
@@ -16,8 +16,6 @@
$this->removeFields();
- $this->manageWidgets();
-
$this->manageValidators();
}
@@ -26,44 +24,12 @@
unset($this['created_at'], $this['updated_at']);
}
- protected function manageWidgets()
- {
- $this->setWidget('file', new sfWidgetFormInputFileEditable(array(
- 'with_delete' => false,
- 'delete_label' => 'usuń plik zdjęcie',
- 'label' => 'Watermark image',
- 'file_src' => '/uploads/images/'.$this->getObject()->getFile(),
- 'is_image' => true,
- 'edit_mode' => !$this->isNew(),
- 'template' => '%file%<br />%input%<br />%delete% %delete_label%',
- )));
- }
-
protected function manageValidators()
{
- $this->setValidator('name',
- new sfValidatorString(array(), array('required' => 'Musisz podać nazwę
zdjęcia.')));
+ $this->setValidator('author',
+ new sfValidatorString(array(), array('required' => 'Musisz podać
autora.')));
- $this->setValidator('file', new sfValidatorFile(array(
- 'required' => true,
- 'path' => sfConfig::get('td_visual_factory_image_dir'),
- 'mime_types' => 'web_images',
- ), array(
- 'required' => 'Musisz wybrać plik',
- )));
+ $this->setValidator('text',
+ new sfValidatorString(array(), array('required' => 'Musisz podać
treść.')));
}
-
- protected function doSave($con = null)
- {
- if (file_exists($this->getObject()->getFile()))
- {
- unlink($this->getObject()->getFile());
- }
-
- $file = $this->getValue('file');
- $filename =
sha1($file->getOriginalName()).'.dupa'.$file->getExtension($file->getOriginalExtension());
- $file->save(sfConfig::get('sf_upload_dir').'/'.$filename);
-
- return parent::doSave($con);
- }
}
Modified:
plugins/tdGuestbookPlugin/trunk/lib/model/doctrine/PlugintdGuestbookTable.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/lib/model/doctrine/PlugintdGuestbookTable.class.php
2010-01-22 15:53:37 UTC (rev 27055)
+++
plugins/tdGuestbookPlugin/trunk/lib/model/doctrine/PlugintdGuestbookTable.class.php
2010-01-22 15:56:06 UTC (rev 27056)
@@ -17,11 +17,12 @@
*
* @return Doctrine_Query
*/
- static public function getActiveEntriesQuery()
+ static public function getActiveSortedEntriesQuery()
{
return Doctrine_Query::create()
- ->from('tdGuestbook e')
- ->where('e.active = "1"');
+ ->from('tdGuestbook e')
+ ->where('e.active = "1"')
+ ->orderBy('e.created_at DESC');
}
/**
@@ -33,7 +34,21 @@
static public function getSelectedEntriesQuery($ids)
{
return Doctrine_Query::create()
- ->from('tdGuestbook e')
- ->whereIn('e.id', $ids);
+ ->from('tdGuestbook e')
+ ->whereIn('e.id', $ids);
}
+
+ /**
+ * Returns DQL query retrieving last active guestbook entry.
+ *
+ * @return Doctrine_Query
+ */
+ static public function getLastActiveEntryQuery()
+ {
+ return Doctrine_Query::create()
+ ->from('tdGuestbook e')
+ ->where('e.active = "1"')
+ ->orderBy('e.updated_at DESC')
+ ->limit(1);
+ }
}
\ No newline at end of file
Modified:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/actions/actions.class.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/actions/actions.class.php
2010-01-22 15:53:37 UTC (rev 27055)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/actions/actions.class.php
2010-01-22 15:56:06 UTC (rev 27056)
@@ -12,27 +12,31 @@
{
public function executeIndex(sfWebRequest $request)
{
-// $this->category = $this->getRoute()->getObject();
+ // ading default td_guestbook layout
+
$this->getResponse()->addStylesheet('/tdGuestbookPlugin/css/td_guestbook.css');
$this->pager = new sfDoctrinePager(
'Guestbook',
sfConfig::get('td_guestbook_entries_per_page')
);
- $this->pager->setQuery($this->guestbooks =
Doctrine::getTable('tdGuestbook')->getActiveEntriesQuery());
+ $this->pager->setQuery($this->guestbooks =
Doctrine::getTable('tdGuestbook')->getActiveSortedEntriesQuery());
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();
}
public function executeNew(sfWebRequest $request)
{
- $this->form = new GuestbookForm();
+ // ading default td_guestbook layout
+
$this->getResponse()->addStylesheet('/tdGuestbookPlugin/css/td_guestbook.css');
+
+ $this->form = new tdGuestbookForm();
}
public function executeCreate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST));
- $this->form = new GuestbookForm();
+ $this->form = new tdGuestbookForm();
$this->processForm($request, $this->form);
@@ -45,8 +49,10 @@
if ($form->isValid())
{
$guestbook = $form->save();
+ $guestbook->setActive(true);
+ $guestbook->save();
- $this->redirect('guestbook/edit?id='.$guestbook->getId());
+ $this->redirect('td_sample_guestbook');
}
}
}
Deleted:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/editSuccess.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/editSuccess.php
2010-01-22 15:53:37 UTC (rev 27055)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/editSuccess.php
2010-01-22 15:56:06 UTC (rev 27056)
@@ -1,3 +0,0 @@
-<h1>Edit Guestbook</h1>
-
-<?php include_partial('form', array('form' => $form)) ?>
Modified:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/indexSuccess.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/indexSuccess.php
2010-01-22 15:53:37 UTC (rev 27055)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/indexSuccess.php
2010-01-22 15:56:06 UTC (rev 27056)
@@ -1,67 +1,78 @@
+<?php use_helper('I18N', 'Date') ?>
+
<h1>Księga gości</h1>
-<a href="<?php echo url_for('guestbook/new') ?>">Wpisz się do księgi gości</a>
+<div class="special">
+ <a href="<?php echo url_for('@td_sample_guestbook_add') ?>">Wpisz się do
księgi gości</a>
+</div>
-<div id="guestbook">
- <?php foreach ($pager->getResults() as $i => $entry): ?>
- <div class="entry">
-
- <span class="author"><?php echo $entry->getAuthor() ?></span>
-
- <?php if($entry->getEmail()): ?>
- <span class="email">
- <a href="mailto:<?php echo $entry->getEmail() ?>"><?php echo
$entry->getEmail() ?></a>
- </span>
+<?php if($results = $pager->getResults(Doctrine_Core::HYDRATE_ARRAY)): ?>
+<ul id="guestbook">
+ <?php foreach ($results as $key => $entry): ?>
+ <li>
+ <div class="author">
+ <span class="value"><?php echo $entry['author'] ?></span>
+ </div>
+ <?php if($entry['email']): ?>
+ <div class="email">
+ <span class="title"><?php echo __('E-mail', array(), 'td') ?>: </span>
+ <span class="value"><a href="mailto:<?php echo $entry['email']
?>"><?php echo $entry['email'] ?></a></span>
+ </div>
<?php endif; ?>
-
- <?php if($entry->getHttp()): ?>
- <span class="http">
- <a href="<?php echo $entry->getHttp() ?>"><?php echo
$entry->getHttp() ?></a>
- </span>
+ <?php if($entry['http']): ?>
+ <div class="http">
+ <span class="title"><?php echo __('WWW', array(), 'td') ?>: </span>
+ <span class="value"><a href="<?php echo $entry['http'] ?>"><?php echo
$entry['http'] ?></a></span>
+ </div>
<?php endif; ?>
+ <div class="text">
+ <span class="value"><?php echo $entry['text'] ?></span>
+ </div>
+ <div class="created_at">
+ <span class="value"><?php echo (false !==
strtotime($entry['created_at']) ? format_date($entry['created_at'], "f") :
' ') ?></span>
+ </div>
+ </li>
+ <?php endforeach; ?>
+</ul>
- <span class="text"><?php echo $entry->getText() ?></span>
-
- <span class="created"><?php echo $entry->getCreatedAt() ?></span>
-
- </div>
- <?php endforeach; ?>
+<div class="special">
+ <a href="<?php echo url_for('@td_sample_guestbook_add') ?>">Wpisz się do
księgi gości</a>
</div>
-<?php if ($pager->haveToPaginate()): ?>
- <div id="pagination">
+<ul id="guestbook_footer">
+ <li>
+ <?php if ($pager->haveToPaginate()): ?>
+ <div class="pagination">
- <a href="?page=1">
- <img src="/tdCorePlugin/images/pagination/first.png" alt="Pierwsza
strona" title="Pierwsza strona" />
- </a>
-
- <a href="?page=<?php echo $pager->getPreviousPage() ?>">
- <img src="/tdCorePlugin/images/pagination/previous.png" alt="Poprzednia
strona" title="Poprzednia strona" />
- </a>
-
- <?php foreach ($pager->getLinks() as $page): ?>
- <?php if ($page == $pager->getPage()): ?>
- <a class="active"><?php echo $page ?></a>
- <?php else: ?>
- <a href="?page=<?php echo $page ?>"><?php echo $page ?></a>
+ <a href="?page=1">
+ <img src="/tdCorePlugin/images/pagination/first.png" alt="Pierwsza
strona" title="Pierwsza strona" />
+ </a>
+ <a href="?page=<?php echo $pager->getPreviousPage() ?>">
+ <img src="/tdCorePlugin/images/pagination/previous.png"
alt="Poprzednia strona" title="Poprzednia strona" />
+ </a>
+ <?php foreach ($pager->getLinks() as $page): ?>
+ <?php if ($page == $pager->getPage()): ?>
+ <a class="active"><?php echo $page ?></a>
+ <?php else: ?>
+ <a href="?page=<?php echo $page ?>"><?php echo $page ?></a>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ <a href="?page=<?php echo $pager->getNextPage() ?>">
+ <img src="/tdCorePlugin/images/pagination/next.png" alt="Następna
strona" title="Następna strona" />
+ </a>
+ <a href="?page=<?php echo $pager->getLastPage() ?>">
+ <img src="/tdCorePlugin/images/pagination/last.png" alt="Ostatnia
strona" title="Ostatnia strona" />
+ </a>
+ </div>
<?php endif; ?>
- <?php endforeach; ?>
-
- <a href="?page=<?php echo $pager->getNextPage() ?>">
- <img src="/tdCorePlugin/images/pagination/next.png" alt="Następna
strona" title="Następna strona" />
- </a>
-
- <a href="?page=<?php echo $pager->getLastPage() ?>">
- <img src="/tdCorePlugin/images/pagination/last.png" alt="Ostatnia
strona" title="Ostatnia strona" />
- </a>
- </div>
+ </li>
+ <li>
+ <div class="stats">
+ <strong><?php echo count($pager) ?></strong>
+ wpisów w księdze<?php if ($pager->haveToPaginate()): ?>,
+ strona <strong><?php echo $pager->getPage() ?>/<?php echo
$pager->getLastPage() ?></strong>
+ <?php endif; ?>
+ </div>
+ </li>
+</ul>
<?php endif; ?>
-
-<div class="pagination">
- <strong><?php echo count($pager) ?></strong> wpisów w księdze
- <?php if ($pager->haveToPaginate()): ?>
- , strona <strong><?php echo $pager->getPage() ?>/<?php echo
$pager->getLastPage() ?></strong>
- <?php endif; ?>
-</div>
-
-<a href="<?php echo url_for('guestbook/new') ?>">Wpisz się do księgi gości</a>
Modified:
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/newSuccess.php
===================================================================
---
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/newSuccess.php
2010-01-22 15:53:37 UTC (rev 27055)
+++
plugins/tdGuestbookPlugin/trunk/modules/tdSampleGuestbook/templates/newSuccess.php
2010-01-22 15:56:06 UTC (rev 27056)
@@ -3,7 +3,9 @@
<h1>Nowy wpis do Księgi Gości</h1>
-<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" ' ?>>
+<ul id="guestbook">
+<li>
+<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" />
<?php endif; ?>
@@ -12,59 +14,43 @@
<tr>
<td colspan="2">
<?php echo $form->renderHiddenFields(false) ?>
- <a href="<?php echo url_for('guestbook/index') ?>">Anuluj</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" />
+ <a href="<?php echo url_for('@td_sample_guestbook')
?>">Anuluj</a>
+ <input type="submit" value="Wpisz się do księgi gości" />
</td>
</tr>
</tfoot>
<tbody>
<?php echo $form->renderGlobalErrors() ?>
<tr>
- <th><?php echo $form['author']->renderLabel() ?></th>
+ <th><?php echo $form['author']->renderLabel('Autor') ?></th>
<td>
<?php echo $form['author']->renderError() ?>
<?php echo $form['author'] ?>
</td>
</tr>
<tr>
- <th><?php echo $form['email']->renderLabel() ?></th>
+ <th><?php echo $form['email']->renderLabel('E-mail') ?></th>
<td>
<?php echo $form['email']->renderError() ?>
<?php echo $form['email'] ?>
</td>
</tr>
<tr>
- <th><?php echo $form['http']->renderLabel() ?></th>
+ <th><?php echo $form['http']->renderLabel('Strona WWW') ?></th>
<td>
<?php echo $form['http']->renderError() ?>
<?php echo $form['http'] ?>
</td>
</tr>
<tr>
- <th><?php echo $form['text']->renderLabel() ?></th>
+ <th><?php echo $form['text']->renderLabel('Treść') ?></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>
-
+</li>
+</ul>
Modified: plugins/tdGuestbookPlugin/trunk/package.xml
===================================================================
--- plugins/tdGuestbookPlugin/trunk/package.xml 2010-01-22 15:53:37 UTC (rev
27055)
+++ plugins/tdGuestbookPlugin/trunk/package.xml 2010-01-22 15:56:06 UTC (rev
27056)
@@ -10,10 +10,10 @@
<email>[email protected]</email>
<active>yes</active>
</lead>
- <date>2010-01-17</date>
+ <date>2010-01-22</date>
<time>11:00:00</time>
<version>
- <release>0.1.1</release>
+ <release>0.1.2</release>
<api>0.1.0</api>
</version>
<stability>
@@ -82,13 +82,18 @@
</dir>
<dir name="templates">
<file name="_form.php" role="data" />
- <file name="editSuccess.php" role="data" />
<file name="indexSuccess.php" role="data" />
<file name="newSuccess.php" role="data" />
</dir>
</dir>
</dir>
+ <dir name="web">
+ <dir name="css">
+ <file name="td_guestbook.css" role="data" />
+ </dir>
+ </dir>
+
<file name="LICENSE" role="data" />
<file name="README" role="data" />
</dir>
@@ -112,7 +117,7 @@
<package>
<name>tdCorePlugin</name>
<channel>plugins.symfony-project.org</channel>
- <min>0.1.3</min>
+ <min>0.1.7</min>
</package>
</required>
</dependencies>
@@ -124,6 +129,25 @@
<release>
<version>
+ <release>0.1.2</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-22</date>
+ <license>MIT</license>
+ <notes>
+ * added stylesheets and modified layout
+ * added model methods
+ * fixed adding posts
+ </notes>
+ </release>
+
+ <release>
+ <version>
<release>0.1.1</release>
<api>0.1.0</api>
</version>
Added: plugins/tdGuestbookPlugin/trunk/web/css/td_guestbook.css
===================================================================
--- plugins/tdGuestbookPlugin/trunk/web/css/td_guestbook.css
(rev 0)
+++ plugins/tdGuestbookPlugin/trunk/web/css/td_guestbook.css 2010-01-22
15:56:06 UTC (rev 27056)
@@ -0,0 +1,76 @@
+#guestbook {
+ list-style-type: none;
+}
+
+#guestbook li {
+ border: 1px solid #bbb;
+ margin: 10px;
+ padding: 5px;
+ background-color: #eee;
+}
+
+#guestbook div {
+ margin: 2px;
+}
+
+#guestbook span.title {
+ font-variant: small-caps;
+}
+
+#guestbook div.link a {
+ font-variant: small-caps;
+}
+
+#guestbook div {
+ text-align: justify;
+}
+
+/* fields */
+
+#guestbook .author {
+ font-weight: bold;
+ font-size: 18px;
+ margin: 10px 0px 0px 10px;
+}
+
+#guestbook .text {
+ margin-top: 10px;
+ font-size: 16px;
+ text-indent: 10px;
+ line-height: 19px;
+}
+
+#guestbook .email {
+ margin-left: 10px;
+}
+
+#guestbook .http {
+ margin-left: 10px;
+}
+
+#guestbook .created_at {
+ margin-top: 10px;
+}
+
+/* footer */
+
+#guestbook_footer {
+ list-style-type: none;
+}
+
+#guestbook_footer .stats {
+ text-align: center;
+}
+
+#guestbook_footer .pagination {
+ text-align: center;
+}
+
+#guestbook_footer .pagination a {
+ font-size: 20px;
+ font-weight: bold;
+}
+
+#guestbook_footer .pagination a.active {
+ color: #888888;
+}
--
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.