Changeset 1108
- Timestamp:
- 04/30/10 15:13:53 (22 months ago)
- Location:
- plugins/apostropheBlogPlugin/trunk
- Files:
-
- 11 modified
-
data/generator/sfDoctrineModule/aBlogAdmin/parts/batchAction.php (modified) (3 diffs)
-
data/generator/sfDoctrineModule/aBlogAdmin/template/templates/_assets.php (modified) (1 diff)
-
lib/model/doctrine/PluginaBlogItemTable.class.php (modified) (1 diff)
-
modules/aBlogAdmin/config/generator.yml (modified) (1 diff)
-
modules/aBlogAdmin/lib/BaseaBlogAdminActions.class.php (modified) (2 diffs)
-
modules/aBlogAdmin/templates/editSuccess.php (modified) (1 diff)
-
modules/aEventAdmin/config/generator.yml (modified) (2 diffs)
-
modules/aEventAdmin/lib/BaseaEventAdminActions.class.php (modified) (2 diffs)
-
modules/aEventAdmin/templates/_form.php (modified) (1 diff)
-
modules/aEventAdmin/templates/editSuccess.php (modified) (1 diff)
-
web/css/aBlog.css (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostropheBlogPlugin/trunk/data/generator/sfDoctrineModule/aBlogAdmin/parts/batchAction.php
r501 r1108 44 44 } 45 45 46 protected function executeBatchDelete(sfWebRequest $request)46 protected function batchAction($action, sfWebRequest $request) 47 47 { 48 // TBB: use collection delete rather than a delete query. This ensures49 // that the object's delete() method is called, which provides50 // for checking userHasPrivileges()51 52 48 $ids = $request->getParameter('ids'); 53 49 … … 60 56 try 61 57 { 62 $items-> delete();58 $items->$action(); 63 59 } catch (Exception $e) 64 60 { 65 61 $error = true; 66 62 } 63 return $error; 64 } 65 66 protected function executeBatchDelete(sfWebRequest $request) 67 { 68 $error = $this->batchAction('delete', $request); 67 69 68 if (($count == count($ ids)) && (!$error))70 if (($count == count($request->getParameter('ids'))) && (!$error)) 69 71 { 70 72 $this->getUser()->setFlash('notice', 'The selected items have been deleted successfully.'); … … 77 79 $this->redirect('@<?php echo $this->getUrlForAction('list') ?>'); 78 80 } 81 82 83 protected function executeBatchPublish(sfWebRequest $request) 84 { 85 $error = $this->batchAction('publish', $request); 86 87 if (($count == count($request->getParameter('ids'))) && (!$error)) 88 { 89 $this->getUser()->setFlash('notice', 'The selected items have been published successfully.'); 90 } 91 else 92 { 93 $this->getUser()->setFlash('error', 'An error occurred while publishing the selected items.'); 94 } 95 96 $this->redirect('@<?php echo $this->getUrlForAction('list') ?>'); 97 } 98 99 protected function executeBatchUnpublish(sfWebRequest $request) 100 { 101 $error = $this->batchAction('unpublish', $request); 102 103 if (($count == count($request->getParameter('ids'))) && (!$error)) 104 { 105 $this->getUser()->setFlash('notice', 'The selected items have been unpublished successfully.'); 106 } 107 else 108 { 109 $this->getUser()->setFlash('error', 'An error occurred while unpublishing the selected items.'); 110 } 111 112 $this->redirect('@<?php echo $this->getUrlForAction('list') ?>'); 113 } -
plugins/apostropheBlogPlugin/trunk/data/generator/sfDoctrineModule/aBlogAdmin/template/templates/_assets.php
r985 r1108 1 [?php slot('body_class') ?]a-admin [?php echo $sf_params->get('module'); ?] [?php echo $sf_params->get('action');?] [?php end_slot() ?]1 [?php slot('body_class') ?]a-admin a-blog-admin [?php echo $sf_params->get('module'); ?] [?php echo $sf_params->get('action');?] [?php end_slot() ?] 2 2 3 3 [?php use_stylesheet('/apostrophePlugin/css/a.css', 'first') ?] -
plugins/apostropheBlogPlugin/trunk/lib/model/doctrine/PluginaBlogItemTable.class.php
r1102 r1108 34 34 } 35 35 36 public function filterByEditable(Doctrine_Query $q, $user_id )36 public function filterByEditable(Doctrine_Query $q, $user_id = null) 37 37 { 38 if(is_null($user_id)) 39 $user_id = sfContext::getInstance()->getUser()->getGuardUser()->getId(); 40 38 41 $rootAlias = $q->getRootAlias(); 39 42 $q->leftJoin($rootAlias.'.Categories c'); -
plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/config/generator.yml
r1046 r1108 20 20 21 21 list: 22 table_method: filterByEditable 22 23 title: "Blog Post Admin" 23 24 display: [ _title, _author_id, _editors_list, _tags_list, _categories_list, status, published_at ] -
plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/lib/BaseaBlogAdminActions.class.php
r1062 r1108 10 10 */ 11 11 abstract class BaseaBlogAdminActions extends autoABlogAdminActions 12 { 12 { 13 13 14 14 public function executeNew(sfWebRequest $request) … … 59 59 $this->setTemplate('edit'); 60 60 } 61 62 protected function buildQuery()63 {64 $tableMethod = $this->configuration->getTableMethod();65 if (is_null($this->filters))66 {67 $this->filters = $this->configuration->getFilterForm($this->getFilters());68 }69 70 $this->filters->setTableMethod($tableMethod);71 72 $query = $this->filters->buildQuery($this->getFilters());73 74 $this->addSortQuery($query);75 76 if(!$this->getUser()->hasCredential('admin'))77 {78 Doctrine::getTable('aBlogPost')->filterByEditable($query, $this->getUser()->getGuardUser()->getId());79 }80 81 $event = $this->dispatcher->filter(new sfEvent($this, 'admin.build_query'), $query);82 $query = $event->getReturnValue();83 84 return $query;85 }86 87 protected function executeBatchPublish(sfWebRequest $request)88 {89 $ids = $request->getParameter('ids');90 91 $items = Doctrine_Query::create()92 ->from('aBlogPost')93 ->whereIn('id', $ids)94 ->execute();95 $count = count($items);96 $error = false;97 try98 {99 foreach($items as $item)100 {101 $item->publish();102 }103 $items->save();104 } catch (Exception $e)105 {106 $error = true;107 }108 109 if (($count == count($ids)) && (!$error))110 {111 $this->getUser()->setFlash('notice', 'The selected items have been published successfully.');112 }113 else114 {115 $this->getUser()->setFlash('error', 'An error occurred while publishing the selected items.');116 }117 118 $this->redirect('@a_blog_admin');119 }120 121 protected function executeBatchUnpublish(sfWebRequest $request)122 {123 $ids = $request->getParameter('ids');124 125 $items = Doctrine_Query::create()126 ->from('aBlogPost')127 ->whereIn('id', $ids)128 ->execute();129 $count = count($items);130 $error = false;131 try132 {133 foreach($items as $item)134 {135 $item->unpublish();136 }137 $items->save();138 } catch (Exception $e)139 {140 $error = true;141 }142 143 if (($count == count($ids)) && (!$error))144 {145 $this->getUser()->setFlash('notice', 'The selected items have been unpublished successfully.');146 }147 else148 {149 $this->getUser()->setFlash('error', 'An error occurred while unpublishing the selected items.');150 }151 152 $this->redirect('@a_blog_admin');153 }154 155 61 } -
plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/templates/editSuccess.php
r1096 r1108 1 1 <?php use_helper('I18N', 'Date', 'jQuery', 'a') ?> 2 2 <?php include_partial('aBlogAdmin/assets') ?> 3 <?php slot('body_class') ?>a-admin <?php echo $sf_params->get('module'); ?> <?php echo $sf_params->get('action') ?> <?php echo $a_blog_post['template'] ?><?php end_slot() ?>3 <?php slot('body_class') ?>a-admin a-blog-admin <?php echo $sf_params->get('module'); ?> <?php echo $sf_params->get('action') ?> <?php echo $a_blog_post['template'] ?><?php end_slot() ?> 4 4 5 5 <div class="a-admin-container <?php echo $sf_params->get('module') ?>"> -
plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/config/generator.yml
r1103 r1108 20 20 21 21 list: 22 title: " Blog Post Admin"22 title: "Event Admin" 23 23 display: [ _title, _author_id, _editors_list, _tags_list, _categories_list, status, published_at ] 24 24 fields: … … 37 37 actions: 38 38 new: 39 label: New Post39 label: New Event 40 40 action: new 41 41 params: -
plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/lib/BaseaEventAdminActions.class.php
r862 r1108 33 33 $this->a_event = $this->getRoute()->getObject(); 34 34 $this->form = $this->configuration->getForm($this->a_event); 35 35 36 36 if($request->isXmlHttpRequest()) 37 37 { … … 40 40 { 41 41 $this->a_event = $this->form->save(); 42 //We need to recreate the form to handle the fact that it is not possible to change the value of a sfFormField 43 $this->form = $this->configuration->getForm($this->a_event); 42 44 $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $this->a_event))); 43 45 } 44 46 $this->setLayout(false); 45 return $this->renderPartial('aEventAdmin/form', array('a_event' => $this->a_event, 'form' => $this->form, 'dog' => '1')); 47 $response = array(); 48 $response['aBlogPost'] = $this->a_event->toArray(); 49 $response['modified'] = $this->a_event->getLastModified(); 50 //Any additional messages can go here 51 $output = json_encode($response); 52 $this->getResponse()->setHttpHeader("X-JSON", '('.$output.')'); 53 return sfView::HEADER_ONLY; 46 54 } 47 55 else -
plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/templates/_form.php
r1103 r1108 12 12 <div class="post-title post-slug option"> 13 13 <?php echo $form['title']->renderRow() ?> 14 <?php echo $form['slug']-> getWidget()->render('a_blog_post[slug]', $a_blog_post['slug']) ?>14 <?php echo $form['slug']->renderRow() ?> 15 15 <?php echo $form['slug']->renderError() ?> 16 16 </div> 17 18 19 17 20 18 <?php // Huge Publish Button and Publish Date ?> -
plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/templates/editSuccess.php
r1103 r1108 11 11 <div class="a-subnav-inner"> 12 12 <ul class="a-admin-action-controls"> 13 <li><a href="<?php echo url_for('@a_ blog_admin'); ?>" class="all-posts-btn"><?php echo __('All Posts', array(), 'apostrophe-blog') ?></a></li>13 <li><a href="<?php echo url_for('@a_event_admin'); ?>" class="all-posts-btn"><?php echo __('All Events', array(), 'apostrophe-blog') ?></a></li> 14 14 <?php include_partial('list_actions', array('helper' => $helper)) ?> 15 15 </ul> -
plugins/apostropheBlogPlugin/trunk/web/css/aBlog.css
r1100 r1108 1 .a BlogAdmin .a-admin-container2 { 3 float: left; 4 width: 100%; 5 } 6 7 .a BlogAdmin #a-content,8 .a BlogAdmin .a-admin-content,9 .a BlogAdmin .a-admin-footer,10 .a BlogAdmin .a-admin-actions11 { 12 width: 100%; 13 } 14 15 .a BlogAdmin .a-admin-content1 .a-blog-admin .a-admin-container 2 { 3 float: left; 4 width: 100%; 5 } 6 7 .a-blog-admin #a-content, 8 .a-blog-admin .a-admin-content, 9 .a-blog-admin .a-admin-footer, 10 .a-blog-admin .a-admin-actions 11 { 12 width: 100%; 13 } 14 15 .a-blog-admin .a-admin-content 16 16 { 17 17 float: right; … … 19 19 } 20 20 21 .a BlogAdmin.edit .a-admin-content21 .a-blog-admin.edit .a-admin-content 22 22 { 23 23 width: 720px; 24 24 } 25 25 26 .a-admin.a BlogAdmin .a-subnav-wrapper26 .a-admin.a-blog-admin .a-subnav-wrapper 27 27 { 28 28 width: 100%; … … 34 34 } 35 35 36 .a-admin.a BlogAdmin .a-subnav-inner36 .a-admin.a-blog-admin .a-subnav-inner 37 37 { 38 38 padding: 0; … … 99 99 } 100 100 101 .a BlogAdmin #a-admin-list-batch-actions,102 .a BlogAdmin #a-admin-list-th-actions101 .a-blog-admin #a-admin-list-batch-actions, 102 .a-blog-admin #a-admin-list-th-actions 103 103 { 104 104 width: auto;

