Author: ornicar2 Date: 2010-02-04 00:47:42 +0100 (Thu, 04 Feb 2010) New Revision: 27523
Added: plugins/dmCommentPlugin/LICENSE plugins/dmCommentPlugin/README plugins/dmCommentPlugin/config/ plugins/dmCommentPlugin/config/dm/ plugins/dmCommentPlugin/config/dm/modules.yml plugins/dmCommentPlugin/config/doctrine/ plugins/dmCommentPlugin/config/doctrine/schema.yml plugins/dmCommentPlugin/data/ plugins/dmCommentPlugin/data/dm/ plugins/dmCommentPlugin/data/dm/i18n/ plugins/dmCommentPlugin/data/dm/i18n/en_fr.yml plugins/dmCommentPlugin/lib/ plugins/dmCommentPlugin/lib/doctrine/ plugins/dmCommentPlugin/lib/doctrine/extension/ plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/ plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/ plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/DmCommentable.php plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/Listener/ plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/Listener/DmCommentable.php plugins/dmCommentPlugin/lib/doctrine/loremizer/ plugins/dmCommentPlugin/lib/doctrine/loremizer/dmCommentRecordLoremizer.php plugins/dmCommentPlugin/lib/filter/ plugins/dmCommentPlugin/lib/filter/doctrine/ plugins/dmCommentPlugin/lib/filter/doctrine/PluginDmCommentFormFilter.class.php plugins/dmCommentPlugin/lib/form/ plugins/dmCommentPlugin/lib/form/doctrine/ plugins/dmCommentPlugin/lib/form/doctrine/PluginDmCommentForm.class.php plugins/dmCommentPlugin/lib/model/ plugins/dmCommentPlugin/lib/model/doctrine/ plugins/dmCommentPlugin/lib/model/doctrine/PluginDmComment.class.php plugins/dmCommentPlugin/lib/model/doctrine/PluginDmCommentTable.class.php plugins/dmCommentPlugin/modules/ plugins/dmCommentPlugin/modules/dmComment/ plugins/dmCommentPlugin/modules/dmComment/actions/ plugins/dmCommentPlugin/modules/dmComment/actions/actions.class.php plugins/dmCommentPlugin/modules/dmComment/actions/components.class.php plugins/dmCommentPlugin/modules/dmComment/lib/ plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentActions.class.php plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentComponents.class.php plugins/dmCommentPlugin/modules/dmComment/templates/ plugins/dmCommentPlugin/modules/dmComment/templates/_form.php plugins/dmCommentPlugin/modules/dmComment/templates/_listForPageRecord.php plugins/dmCommentPlugin/modules/dmCommentAdmin/ plugins/dmCommentPlugin/modules/dmCommentAdmin/actions/ plugins/dmCommentPlugin/modules/dmCommentAdmin/actions/actions.class.php plugins/dmCommentPlugin/modules/dmCommentAdmin/config/ plugins/dmCommentPlugin/modules/dmCommentAdmin/config/generator.yml plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/ plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminExport.class.php plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminForm.php plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorConfiguration.class.php plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorHelper.class.php plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/ plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_author_name.php plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_comments.php plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_record_id.php Log: [Diem][dmCommentPlugin] initial commit Added: plugins/dmCommentPlugin/LICENSE =================================================================== --- plugins/dmCommentPlugin/LICENSE (rev 0) +++ plugins/dmCommentPlugin/LICENSE 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,19 @@ +Copyright (c) 2010 Thibault Duplessis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file Added: plugins/dmCommentPlugin/README =================================================================== --- plugins/dmCommentPlugin/README (rev 0) +++ plugins/dmCommentPlugin/README 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,15 @@ +dmCommentPlugin +================= + +The `dmCommentPlugin` allows to add comments to your records. +It packages +- a Doctrine behaviour, "DmCommentable" +- two front widgets: "Form" and "Page comments" +- an admin interface to manage comments +Integrates recaptcha validation. +The plugin is fully extensible. Only works with [Diem 5.0](http://diem-project.org/) installed. + +Documentation +------------- + +See the online documentation : [Diem Comment plugin documentation](http://diem-project.org/plugins/dmcommentplugin) \ No newline at end of file Added: plugins/dmCommentPlugin/config/dm/modules.yml =================================================================== --- plugins/dmCommentPlugin/config/dm/modules.yml (rev 0) +++ plugins/dmCommentPlugin/config/dm/modules.yml 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,9 @@ +Project: + + Feedback: + + dmComment: + name: Comment + actions: + form: + listForPageRecord: { name: Page comments } \ No newline at end of file Added: plugins/dmCommentPlugin/config/doctrine/schema.yml =================================================================== --- plugins/dmCommentPlugin/config/doctrine/schema.yml (rev 0) +++ plugins/dmCommentPlugin/config/doctrine/schema.yml 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,13 @@ +DmComment: + + actAs: + Timestampable: + + columns: + record_model: { type: string(255), notnull: true } + record_id: { type: integer, notnull: true } + author_name: { type: string(255), notnull: true } + author_email: { type: string(255), notnull: false } + author_website: { type: string(255), notnull: false, extra: link } + body: { type: clob, notnull: true } + is_active: { type: boolean, notnull: true, default: true } \ No newline at end of file Added: plugins/dmCommentPlugin/data/dm/i18n/en_fr.yml =================================================================== --- plugins/dmCommentPlugin/data/dm/i18n/en_fr.yml (rev 0) +++ plugins/dmCommentPlugin/data/dm/i18n/en_fr.yml 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,3 @@ +"Your email will never be published": "Votre courriel ne sera jamais publié" +"Please enter a message": "Veuillez saisir un message" +"Thank you, your comment has been sent.", "Merci, votre commentaire a été envoyé." \ No newline at end of file Added: plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/DmCommentable.php =================================================================== --- plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/DmCommentable.php (rev 0) +++ plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/DmCommentable.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,62 @@ +<?php + +/** + * Add comment capabilities to your models + */ +class Doctrine_Template_DmCommentable extends Doctrine_Template +{ + public function setTableDefinition() + { + $this->addListener(new Doctrine_Template_Listener_DmCommentable($this->_options)); + } + + public function hasComments($onlyActiveComments = true) + { + return $this->getNbComments($onlyActiveComments) > 0; + } + + public function getNbComments($onlyActiveComments = true) + { + return $this->getCommentsQuery($onlyActiveComments)->count(); + } + + public function addComment(DmComment $comment) + { + $comment->set('record_model', $this->_invoker->getTable()->getComponentName()); + $comment->set('record_id', $this->_invoker->get('id')); + $comment->save(); + + return $this->_invoker; + } + + /* + * Returns active comments + */ + public function getComments() + { + return $comments = $this->getCommentsQuery(true)->fetchRecords(); + } + + /* + * Returns both active and inactive comments + */ + public function getAllComments() + { + return $comments = $this->getCommentsQuery(false)->fetchRecords(); + } + + public function getCommentsQuery($onlyActiveComments = true) + { + $query = dmDb::table('DmComment')->createQuery('c') + ->where('c.record_id = ?', $this->_invoker->get('id')) + ->andWhere('c.record_model = ?', $this->_invoker->getTable()->getComponentName()) + ->orderBy('c.created_at ASC'); + + if($onlyActiveComments) + { + $query->andWhere('c.is_active = ?', true); + } + + return $query; + } +} \ No newline at end of file Added: plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/Listener/DmCommentable.php =================================================================== --- plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/Listener/DmCommentable.php (rev 0) +++ plugins/dmCommentPlugin/lib/doctrine/extension/DmCommentable/Template/Listener/DmCommentable.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,15 @@ +<?php + +class Doctrine_Template_Listener_DmCommentable extends Doctrine_Record_Listener +{ + + public function __construct($options = array()) + { + $this->_options = $options; + } + + public function postDelete(Doctrine_Event $event) + { + $event->getInvoker()->getComments()->delete(); + } +} \ No newline at end of file Added: plugins/dmCommentPlugin/lib/doctrine/loremizer/dmCommentRecordLoremizer.php =================================================================== --- plugins/dmCommentPlugin/lib/doctrine/loremizer/dmCommentRecordLoremizer.php (rev 0) +++ plugins/dmCommentPlugin/lib/doctrine/loremizer/dmCommentRecordLoremizer.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,26 @@ +<?php + +class dmCommentRecordLoremizer extends dmRecordLoremizer +{ + + public function execute(dmDoctrineRecord $record) + { + $commentableModels = $record->getTable()->getCommentableModels(); + + if(empty($commentableModels)) + { + throw new dmException('There is no commentable model'); + } + + parent::execute($record); + + $model = $commentableModels[array_rand($commentableModels)]; + $id = $this->getRandomId(dmDb::table($model)); + + $record->set('record_model', $model); + $record->set('record_id', $id); + + return $record; + } + +} \ No newline at end of file Added: plugins/dmCommentPlugin/lib/filter/doctrine/PluginDmCommentFormFilter.class.php =================================================================== --- plugins/dmCommentPlugin/lib/filter/doctrine/PluginDmCommentFormFilter.class.php (rev 0) +++ plugins/dmCommentPlugin/lib/filter/doctrine/PluginDmCommentFormFilter.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,13 @@ +<?php + +/** + * PluginDmComment form. + * + * @package ##PROJECT_NAME## + * @subpackage filter + * @author ##AUTHOR_NAME## + * @version SVN: $Id: sfDoctrineFormFilterPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +abstract class PluginDmCommentFormFilter extends BaseDmCommentFormFilter +{ +} Added: plugins/dmCommentPlugin/lib/form/doctrine/PluginDmCommentForm.class.php =================================================================== --- plugins/dmCommentPlugin/lib/form/doctrine/PluginDmCommentForm.class.php (rev 0) +++ plugins/dmCommentPlugin/lib/form/doctrine/PluginDmCommentForm.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,56 @@ +<?php + +/** + * PluginDmComment form. + * + * @package ##PROJECT_NAME## + * @subpackage form + * @author ##AUTHOR_NAME## + * @version SVN: $Id$ + */ +abstract class PluginDmCommentForm extends BaseDmCommentForm +{ + public function setup() + { + parent::setup(); + + unset($this['is_active']); + + $this->changeToHidden('record_model'); + $this->changeToHidden('record_id'); + + $this->widgetSchema->setLabel('author_name', 'Name'); + $this->widgetSchema->setLabel('author_website', 'Website'); + $this->widgetSchema->setLabel('author_email', 'Email'); + $this->widgetSchema->setLabel('body', 'Message'); + + $this->validatorSchema['body'] + ->setOption('required', true) + ->setMessage('required', 'Please enter a message'); + + $this->widgetSchema->setHelp('author_email', 'Your email will never be published'); + + $this->changeToEmail('author_email'); + + if ($this->isCaptchaEnabled()) + { + $this->addCaptcha(); + } + } + + public function addCaptcha() + { + $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array( + 'public_key' => sfConfig::get('app_recaptcha_public_key') + )); + + $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array( + 'private_key' => sfConfig::get('app_recaptcha_private_key') + )); + } + + public function isCaptchaEnabled() + { + return sfConfig::get('app_recaptcha_enabled'); + } +} \ No newline at end of file Added: plugins/dmCommentPlugin/lib/model/doctrine/PluginDmComment.class.php =================================================================== --- plugins/dmCommentPlugin/lib/model/doctrine/PluginDmComment.class.php (rev 0) +++ plugins/dmCommentPlugin/lib/model/doctrine/PluginDmComment.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,16 @@ +<?php + +abstract class PluginDmComment extends BaseDmComment +{ + + public function getRecord() + { + if($this->hasCache('record')) + { + return $this->getCache('record'); + } + + return dmDb::table($this->record_model)->find($this->record_id); + } + +} \ No newline at end of file Added: plugins/dmCommentPlugin/lib/model/doctrine/PluginDmCommentTable.class.php =================================================================== --- plugins/dmCommentPlugin/lib/model/doctrine/PluginDmCommentTable.class.php (rev 0) +++ plugins/dmCommentPlugin/lib/model/doctrine/PluginDmCommentTable.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,35 @@ +<?php +/** + */ +class PluginDmCommentTable extends myDoctrineTable +{ + + public function getRecordLoremizerClass() + { + return 'dmCommentRecordLoremizer'; + } + + public function getCommentableModels() + { + if ($this->hasCache('commentable_models')) + { + return $this->getCache('commentable_models'); + } + + $models = array(); + foreach(dmProject::getAllModels() as $model) + { + if (dmDb::table($model)->hasTemplate('DmCommentable')) + { + $models[] = $model; + } + } + + return $this->setCache('commentable_models', $models); + } + + public function getIdentifierColumnName() + { + return 'author_name'; + } +} \ No newline at end of file Added: plugins/dmCommentPlugin/modules/dmComment/actions/actions.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmComment/actions/actions.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmComment/actions/actions.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,11 @@ +<?php + +require_once realpath(dirname(__FILE__).'/..').'/lib/BasedmCommentActions.class.php'; + +/** + * Comment actions + */ +class dmCommentActions extends BasedmCommentActions +{ + +} Property changes on: plugins/dmCommentPlugin/modules/dmComment/actions/actions.class.php ___________________________________________________________________ Added: svn:executable + * Added: plugins/dmCommentPlugin/modules/dmComment/actions/components.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmComment/actions/components.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmComment/actions/components.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,13 @@ +<?php + +require_once realpath(dirname(__FILE__).'/..').'/lib/BasedmCommentComponents.class.php'; + +/** + * Comment components + * + * No redirection nor database manipulation ( insert, update, delete ) here + */ +class dmCommentComponents extends BasedmCommentComponents +{ + +} Property changes on: plugins/dmCommentPlugin/modules/dmComment/actions/components.class.php ___________________________________________________________________ Added: svn:executable + * Added: plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentActions.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentActions.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentActions.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,38 @@ +<?php + +class BasedmCommentActions extends myFrontModuleActions +{ + + public function executeFormWidget(dmWebRequest $request) + { + $form = $this->forms['DmComment']; + + if ($request->hasParameter($form->getName())) + { + $data = $request->getParameter($form->getName()); + + if($form->isCaptchaEnabled()) + { + $data = array_merge($data, array('captcha' => array( + 'recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), + 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'), + ))); + } + + $form->bind($data); + + if ($form->isValid()) + { + $form->save(); + + $this->getUser()->setFlash('comment_form_valid', true); + + $this->getService('dispatcher')->notify(new sfEvent($this, 'dm_comment.saved'), array( + 'comment' => $form->getObject() + )); + + $this->redirectBack(); + } + } + } +} \ No newline at end of file Added: plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentComponents.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentComponents.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmComment/lib/BasedmCommentComponents.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,42 @@ +<?php + +class BasedmCommentComponents extends myFrontModuleComponents +{ + + public function executeForm() + { + $this->form = $this->forms['DmComment']; + + $record = $this->getPageRecord(); + + $this->form->setDefault('record_model', $record->getTable()->getComponentName()); + $this->form->setDefault('record_id', $record->get('id')); + } + + public function executeListForPageRecord() + { + $record = $this->getPageRecord(); + + $query = $this->getListQuery('c') + ->addWhere('c.record_model = ?', $record->getTable()->getComponentName()) + ->addWhere('c.record_id = ?', $record->get('id')); + + $this->dmCommentPager = $this->getPager($query); + } + + protected function getPageRecord() + { + if(!$record = $this->getPage()->getRecord()) + { + throw new dmException('This page has no record'); + } + + if(!$record->getTable()->hasTemplate('DmCommentable')) + { + throw new dmException(sprintf('%s records are not commentable', $record->getTable()->getComponentName())); + } + + return $record; + } + +} \ No newline at end of file Added: plugins/dmCommentPlugin/modules/dmComment/templates/_form.php =================================================================== --- plugins/dmCommentPlugin/modules/dmComment/templates/_form.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmComment/templates/_form.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,36 @@ +<?php +// Contact : Form +// Vars : $form + +if($sf_user->hasFlash('comment_form_valid')) +{ + echo _tag('p.form_valid', __('Thank you, your comment has been sent.')); +} + +// open the form tag with a dm_comment_form css class +echo $form->open(); + +// write name label, field and error message +echo $form['author_name']->label()->field()->error(); + +// same with website +echo $form['author_website']->label()->field()->error(); + +// same with email, plus a help message +echo $form['author_email']->label()->field()->help()->error(); + +echo $form['body']->label('Your message')->field()->error(); + +// render captcha if enabled +if($form->isCaptchaEnabled()) +{ + echo $form['captcha']->label('Captcha', 'for=false')->field()->error(); +} + +echo $form->renderHiddenFields(); + +// change the submit button text +echo _tag('div.submit_wrap', $form->submit('Send')); + +// close the form tag +echo $form->close(); \ No newline at end of file Property changes on: plugins/dmCommentPlugin/modules/dmComment/templates/_form.php ___________________________________________________________________ Added: svn:executable + * Added: plugins/dmCommentPlugin/modules/dmComment/templates/_listForPageRecord.php =================================================================== --- plugins/dmCommentPlugin/modules/dmComment/templates/_listForPageRecord.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmComment/templates/_listForPageRecord.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,37 @@ +<?php // Vars: $dmCommentPager + +use_helper('Date', 'Text'); + +echo $dmCommentPager->renderNavigationTop(); + +echo _open('ul.elements'); + +foreach ($dmCommentPager as $dmComment) +{ + echo _open('li.element'); + + // if the comment author has a website + if($dmComment->authorWebsite) + { + // show the author with a link to his/her site + $author = _link($dmComment->authorWebsite)->text(escape($dmComment->authorName)); + } + else + { + // just show the author + $author = escape($dmComment->authorName); + } + + echo _tag('p.infos', + _tag('span.author', $author). + _tag('span.date', format_date($dmComment->createdAt, 'D')) + ); + + echo _tag('p', simple_format_text(escape($dmComment->body))); + + echo _close('li'); +} + +echo _close('ul'); + +echo $dmCommentPager->renderNavigationBottom(); \ No newline at end of file Property changes on: plugins/dmCommentPlugin/modules/dmComment/templates/_listForPageRecord.php ___________________________________________________________________ Added: svn:executable + * Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/actions/actions.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/actions/actions.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/actions/actions.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,16 @@ +<?php + +require_once dirname(__FILE__).'/../lib/dmCommentAdminGeneratorConfiguration.class.php'; +require_once dirname(__FILE__).'/../lib/dmCommentAdminGeneratorHelper.class.php'; + +/** + * dmCommentAdmin actions. + * + * @package test + * @subpackage dmCommentAdmin + * @author Your name here + * @version SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $ + */ +class dmCommentAdminActions extends autoDmCommentAdminActions +{ +} Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/config/generator.yml =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/config/generator.yml (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/config/generator.yml 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,54 @@ +generator: + class: dmAdminDoctrineGenerator + param: + model_class: DmComment + theme: dmAdmin + non_verbose_templates: true + with_show: false + route_prefix: dm_comment + with_doctrine_route: false + config: + actions: ~ + fields: + is_active: + label: Active + record_model: + label: Model + record_id: + label: Record + list: + display: + - _author_name + - record_model + - _record_id + - body + - is_active + - created_at + - updated_at + sort: + - created_at + - desc + table_method: getAdminListQuery + table_count_method: ~ + sortable: false + filter: + display: + - id + - is_active + - record_model + - record_id + - author_name + - author_email + - author_website + - body + - created_at + - updated_at + form: + display: + NONE: [record_model, record_id, is_active] + Body: [body] + Author: [author_name, author_email, author_website] + class: DmCommentAdminForm + fields: { } + edit: ~ + new: ~ Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminExport.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminExport.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminExport.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,12 @@ +<?php + +/** + * dmCommentAdmin admin export + * + * @package test + * @subpackage dmCommentAdmin + * @author Your name here + */ +class DmCommentAdminExport extends myDoctrineTableExport +{ +} Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminForm.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminForm.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/DmCommentAdminForm.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,16 @@ +<?php + +/** + * dmCommentAdmin admin form + * + * @package test + * @subpackage dmCommentAdmin + * @author Your name here + */ +class DmCommentAdminForm extends BaseDmCommentForm +{ + public function configure() + { + parent::configure(); + } +} \ No newline at end of file Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorConfiguration.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorConfiguration.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorConfiguration.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,13 @@ +<?php + +/** + * dmCommentAdmin module configuration. + * + * @package test + * @subpackage dmCommentAdmin + * @author Your name here + * @version SVN: $Id: configuration.php 12474 2008-10-31 10:41:27Z fabien $ + */ +class dmCommentAdminGeneratorConfiguration extends BaseDmCommentAdminGeneratorConfiguration +{ +} Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorHelper.class.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorHelper.class.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/lib/dmCommentAdminGeneratorHelper.class.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,13 @@ +<?php + +/** + * dmCommentAdmin module helper. + * + * @package test + * @subpackage dmCommentAdmin + * @author Your name here + * @version SVN: $Id: helper.php 12474 2008-10-31 10:41:27Z fabien $ + */ +class dmCommentAdminGeneratorHelper extends BaseDmCommentAdminGeneratorHelper +{ +} Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_author_name.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_author_name.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_author_name.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,7 @@ +<?php + +echo _link($dm_comment)->text($dm_comment->authorName). +'<br />'. +$dm_comment->authorWebsite. +'<br />'. +$dm_comment->authorEmail; \ No newline at end of file Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_comments.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_comments.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_comments.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,26 @@ +<?php + +if(!$record->getTable()->hasTemplate('DmCommentable')) +{ + throw new dmException(sprintf('%s records are not commentable', $record->getTable()->getComponentName())); +} + +$comments = $record->getAllComments(); + +echo _open('div.dm_foreigns'); + + if ($comments->count()) + { + echo _open('ul.list'); + + foreach($comments as $comment) + { + echo _tag('li', + _link($comment)->title(__('Open'))->set('.associated_record.s16right.s16_arrow_up_right_medium') + ); + } + + echo _close('ul'); + } + +echo _close('div'); \ No newline at end of file Added: plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_record_id.php =================================================================== --- plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_record_id.php (rev 0) +++ plugins/dmCommentPlugin/modules/dmCommentAdmin/templates/_record_id.php 2010-02-03 23:47:42 UTC (rev 27523) @@ -0,0 +1,3 @@ +<?php + +echo _link($dm_comment->getRecord())->set('.associated_record.s16right.s16_arrow_up_right_medium'); \ No newline at end of file -- 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.
