To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Changeset 1108

Show
Ignore:
Timestamp:
04/30/10 15:13:53 (22 months ago)
Author:
dordille
Message:

rescoped aBlogAdmin body class to a-blog-admin for compatibility with aEventAdmin

Location:
plugins/apostropheBlogPlugin/trunk
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostropheBlogPlugin/trunk/data/generator/sfDoctrineModule/aBlogAdmin/parts/batchAction.php

    r501 r1108  
    4444  } 
    4545 
    46   protected function executeBatchDelete(sfWebRequest $request) 
     46  protected function batchAction($action, sfWebRequest $request) 
    4747  { 
    48     // TBB: use collection delete rather than a delete query. This ensures 
    49     // that the object's delete() method is called, which provides 
    50     // for checking userHasPrivileges() 
    51      
    5248    $ids = $request->getParameter('ids'); 
    5349 
     
    6056    try 
    6157    { 
    62       $items->delete(); 
     58      $items->$action(); 
    6359    } catch (Exception $e) 
    6460    { 
    6561      $error = true; 
    6662    } 
     63    return $error; 
     64  } 
     65 
     66  protected function executeBatchDelete(sfWebRequest $request) 
     67  { 
     68    $error = $this->batchAction('delete', $request); 
    6769     
    68     if (($count == count($ids)) && (!$error)) 
     70    if (($count == count($request->getParameter('ids'))) && (!$error)) 
    6971    { 
    7072      $this->getUser()->setFlash('notice', 'The selected items have been deleted successfully.'); 
     
    7779    $this->redirect('@<?php echo $this->getUrlForAction('list') ?>'); 
    7880  } 
     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() ?] 
    22 
    33  [?php use_stylesheet('/apostrophePlugin/css/a.css', 'first') ?] 
  • plugins/apostropheBlogPlugin/trunk/lib/model/doctrine/PluginaBlogItemTable.class.php

    r1102 r1108  
    3434  } 
    3535 
    36   public function filterByEditable(Doctrine_Query $q, $user_id) 
     36  public function filterByEditable(Doctrine_Query $q, $user_id = null) 
    3737  { 
     38    if(is_null($user_id)) 
     39      $user_id = sfContext::getInstance()->getUser()->getGuardUser()->getId(); 
     40 
    3841    $rootAlias = $q->getRootAlias(); 
    3942    $q->leftJoin($rootAlias.'.Categories c'); 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/config/generator.yml

    r1046 r1108  
    2020       
    2121      list: 
     22        table_method:   filterByEditable 
    2223        title:    "Blog Post Admin" 
    2324        display:  [ _title, _author_id, _editors_list, _tags_list, _categories_list, status, published_at ] 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/lib/BaseaBlogAdminActions.class.php

    r1062 r1108  
    1010 */ 
    1111abstract class BaseaBlogAdminActions extends autoABlogAdminActions 
    12 {  
     12{ 
    1313 
    1414  public function executeNew(sfWebRequest $request) 
     
    5959    $this->setTemplate('edit'); 
    6060  } 
    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     try 
    98     { 
    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     else 
    114     { 
    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     try 
    132     { 
    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     else 
    148     { 
    149       $this->getUser()->setFlash('error', 'An error occurred while unpublishing the selected items.'); 
    150     } 
    151  
    152     $this->redirect('@a_blog_admin'); 
    153   } 
    154    
    15561} 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogAdmin/templates/editSuccess.php

    r1096 r1108  
    11<?php use_helper('I18N', 'Date', 'jQuery', 'a') ?> 
    22<?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() ?> 
    44 
    55<div class="a-admin-container <?php echo $sf_params->get('module') ?>"> 
  • plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/config/generator.yml

    r1103 r1108  
    2020 
    2121      list: 
    22         title:    "Blog Post Admin" 
     22        title:    "Event Admin" 
    2323        display:  [ _title, _author_id, _editors_list, _tags_list, _categories_list, status, published_at ] 
    2424        fields: 
     
    3737        actions: 
    3838          new: 
    39             label: New Post 
     39            label: New Event 
    4040            action: new 
    4141            params: 
  • plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/lib/BaseaEventAdminActions.class.php

    r862 r1108  
    3333    $this->a_event = $this->getRoute()->getObject(); 
    3434    $this->form = $this->configuration->getForm($this->a_event); 
    35      
     35 
    3636    if($request->isXmlHttpRequest()) 
    3737    { 
     
    4040      { 
    4141        $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); 
    4244        $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $this->a_event))); 
    4345      } 
    4446      $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; 
    4654    } 
    4755    else 
  • plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/templates/_form.php

    r1103 r1108  
    1212<div class="post-title post-slug option"> 
    1313  <?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() ?> 
    1515  <?php echo $form['slug']->renderError() ?> 
    1616</div> 
    17  
    18  
    1917 
    2018<?php // Huge Publish Button and Publish Date ?> 
  • plugins/apostropheBlogPlugin/trunk/modules/aEventAdmin/templates/editSuccess.php

    r1103 r1108  
    1111                        <div class="a-subnav-inner"> 
    1212                                <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> 
    1414                 <?php include_partial('list_actions', array('helper' => $helper)) ?> 
    1515                                </ul> 
  • plugins/apostropheBlogPlugin/trunk/web/css/aBlog.css

    r1100 r1108  
    1 .aBlogAdmin .a-admin-container 
    2 { 
    3 float: left; 
    4 width: 100%; 
    5 } 
    6  
    7 .aBlogAdmin #a-content, 
    8 .aBlogAdmin .a-admin-content, 
    9 .aBlogAdmin .a-admin-footer, 
    10 .aBlogAdmin .a-admin-actions 
    11 { 
    12 width: 100%; 
    13 } 
    14  
    15 .aBlogAdmin .a-admin-content 
     1.a-blog-admin .a-admin-container 
     2{ 
     3float: left; 
     4width: 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{ 
     12width: 100%; 
     13} 
     14 
     15.a-blog-admin .a-admin-content 
    1616{ 
    1717float: right; 
     
    1919} 
    2020 
    21 .aBlogAdmin.edit .a-admin-content 
     21.a-blog-admin.edit .a-admin-content 
    2222{ 
    2323width: 720px; 
    2424} 
    2525 
    26 .a-admin.aBlogAdmin .a-subnav-wrapper 
     26.a-admin.a-blog-admin .a-subnav-wrapper 
    2727{ 
    2828width: 100%; 
     
    3434} 
    3535 
    36 .a-admin.aBlogAdmin .a-subnav-inner 
     36.a-admin.a-blog-admin .a-subnav-inner 
    3737{ 
    3838        padding: 0; 
     
    9999} 
    100100 
    101 .aBlogAdmin #a-admin-list-batch-actions, 
    102 .aBlogAdmin #a-admin-list-th-actions 
     101.a-blog-admin #a-admin-list-batch-actions, 
     102.a-blog-admin #a-admin-list-th-actions 
    103103{ 
    104104width: auto;