Assembla home | Assembla project page
 

Changeset 118

Show
Ignore:
Timestamp:
07/19/07 10:16:35 (1 year ago)
Author:
digitalspaghetti
Message:

Updating views & controllers for User, videos, pages, posts and general forms. Added new helper for Webrocket functionality

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branch/app_controller.php

    r117 r118  
    3939class AppController extends Controller { 
    4040         
    41         var $helpers = array('othAuth','Cache','Form','Html','Javascript','Text','Number','Time','Tree'); 
     41        var $helpers = array('othAuth','Cache','Form','Html','Javascript','Text','Number','Time','Tree','Webrocket'); 
    4242        var $components = array('othAuth','Conf','RequestHandler','Session','Nav'); 
    4343        var $othAuthRestrictions = array('add','edit','delete',CAKE_ADMIN); 
  • branch/app_model.php

    r71 r118  
    285285            } 
    286286        } 
     287                 
     288        function publish($id) 
     289    { 
     290        $this->id = $id; 
     291        $this->$this->name->savefield('published', 1); 
     292    } 
     293     
     294        function unpublish($id) 
     295    { 
     296        $this->id = $id; 
     297        $this->$this->name->savefield('published', 0); 
     298    } 
    287299} 
    288300?> 
  • branch/controllers/pages_controller.php

    r60 r118  
    1010        } 
    1111 
    12         function view($id = null) { 
    13                 if(!$id) { 
     12        function view($slug = null) { 
     13                if(!$slug) { 
    1414                        $this->Session->setFlash('Invalid Page.'); 
    1515                        $this->redirect(array('action'=>'index'), null, true); 
    1616                } 
    17                 $this->set('page', $this->Page->findByStub($id)); 
     17                $this->set('page', $this->Page->findBySlug($slug)); 
    1818        } 
    1919 
  • branch/controllers/posts_controller.php

    r111 r118  
    3939        // The view function finds by Stub instead of ID for SEO. 
    4040        function view($slug = null) { 
    41                 if(!$id) { 
     41                if(!$slug) { 
    4242                        $this->Session->setFlash('Invalid Post.'); 
    4343                        $this->redirect(array('action'=>'index'), null, true); 
  • branch/models/page.php

    r69 r118  
    4949        function beforeSave() 
    5050    { 
    51         $this->data[$this->name]['stub'] = $this->getUniqueUrl($this->data[$this->name]['title'], 'stub'); 
    52          
     51        $this->data[$this->name]['slug'] = $this->getUniqueUrl($this->data[$this->name]['title'], 'slug');  
    5352        return true; 
    5453    }  
  • branch/models/post.php

    r109 r118  
    4848        return true; 
    4949    } 
    50      
    51     function publish($id) 
    52     { 
    53         $this->id = $id; 
    54         $this->savefield('published', 1); 
    55     } 
    56      
    57         function unpublish($id) 
    58     { 
    59         $this->id = $id; 
    60         $this->savefield('published', 0); 
    61     } 
    6250         
    6351        function postCount() 
  • branch/models/user.php

    r69 r118  
    2323        //The Associations below have been created with all possible keys, those that are not needed can be removed 
    2424        var $belongsTo = array( 
    25                         'Group' => array('className' => 'Group', 
    26                                                                 'foreignKey' => 'group_id', 
    27                                                                 'conditions' => '', 
    28                                                                 'fields' => '', 
    29                                                                 'order' => '', 
    30                                                                 'counterCache' => ''), 
     25                        'Group' => array('className' => 'Group'), 
    3126        ); 
    3227 
    3328        var $hasOne = array( 
    34                         'Profile' => array('className' => 'Profile', 
    35                                                                 'foreignKey' => 'user_id', 
    36                                                                 'conditions' => '', 
    37                                                                 'fields' => '', 
    38                                                                 'order' => '', 
    39                                                                 'dependent' => ''), 
     29                        'Profile' => array('className' => 'Profile'), 
    4030        ); 
    4131 
    4232        var $hasMany = array( 
    43                         'Comment' => array('className' => 'Comment', 
    44                                                                 'foreignKey' => 'user_id', 
    45                                                                 'conditions' => '', 
    46                                                                 'fields' => '', 
    47                                                                 'order' => '', 
    48                                                                 'limit' => '', 
    49                                                                 'offset' => '', 
    50                                                                 'dependent' => '', 
    51                                                                 'exclusive' => '', 
    52                                                                 'finderQuery' => '', 
    53                                                                 'counterQuery' => ''), 
    54                         'Event' => array('className' => 'Event', 
    55                                                                 'foreignKey' => 'user_id', 
    56                                                                 'conditions' => '', 
    57                                                                 'fields' => '', 
    58                                                                 'order' => '', 
    59                                                                 'limit' => '', 
    60                                                                 'offset' => '', 
    61                                                                 'dependent' => '', 
    62                                                                 'exclusive' => '', 
    63                                                                 'finderQuery' => '', 
    64                                                                 'counterQuery' => ''), 
    65                         'Image' => array('className' => 'Image', 
    66                                                                 'foreignKey' => 'user_id', 
    67                                                                 'conditions' => '', 
    68                                                                 'fields' => '', 
    69                                                                 'order' => '', 
    70                                                                 'limit' => '', 
    71                                                                 'offset' => '', 
    72                                                                 'dependent' => '', 
    73                                                                 'exclusive' => '', 
    74                                                                 'finderQuery' => '', 
    75                                                                 'counterQuery' => ''), 
    76                         'Page' => array('className' => 'Page', 
    77                                                                 'foreignKey' => 'user_id', 
    78                                                                 'conditions' => '', 
    79                                                                 'fields' => '', 
    80                                                                 'order' => '', 
    81                                                                 'limit' => '', 
    82                                                                 'offset' => '', 
    83                                                                 'dependent' => '', 
    84                                                                 'exclusive' => '', 
    85                                                                 'finderQuery' => '', 
    86                                                                 'counterQuery' => ''), 
    87                         'Post' => array('className' => 'Post', 
    88                                                                 'foreignKey' => 'user_id', 
    89                                                                 'conditions' => '', 
    90                                                                 'fields' => '', 
    91                                                                 'order' => '', 
    92                                                                 'limit' => '', 
    93                                                                 'offset' => '', 
    94                                                                 'dependent' => '', 
    95                                                                 'exclusive' => '', 
    96                                                                 'finderQuery' => '', 
    97                                                                 'counterQuery' => ''), 
    98                         'Video' => array('className' => 'Video', 
    99                                                                 'foreignKey' => 'user_id', 
    100                                                                 'conditions' => '', 
    101                                                                 'fields' => '', 
    102                                                                 'order' => '', 
    103                                                                 'limit' => '', 
    104                                                                 'offset' => '', 
    105                                                                 'dependent' => '', 
    106                                                                 'exclusive' => '', 
    107                                                                 'finderQuery' => '', 
    108                                                                 'counterQuery' => ''), 
     33                        'Comment' => array('className' => 'Comment'), 
     34                        'Event' => array('className' => 'Event'), 
     35                        'Image' => array('className' => 'Image'), 
     36                        'Page' => array('className' => 'Page'), 
     37                        'Post' => array('className' => 'Post'), 
     38                        'Video' => array('className' => 'Video'), 
    10939        ); 
    11040 
     
    11444                                                'foreignKey' => 'user_id', 
    11545                                                'associationForeignKey' => 'tag_id', 
    116                                                 'conditions' => '', 
    117                                                 'fields' => '', 
    118                                                 'order' => '', 
    119                                                 'limit' => '', 
    120                                                 'offset' => '', 
    121                                                 'unique' => '', 
    122                                                 'finderQuery' => '', 
    123                                                 'deleteQuery' => '', 
    124                                                 'insertQuery' => ''), 
     46                                                'order' => 'Tag.tag ASC', 
     47                                                'unique' => true), 
    12548        ); 
     49         
     50         
    12651 
    12752} 
  • branch/models/video.php

    r73 r118  
    1010        //The Associations below have been created with all possible keys, those that are not needed can be removed 
    1111        var $belongsTo = array( 
    12                         'User' => array('className' => 'User', 
    13                                                                 'foreignKey' => 'user_id', 
    14                                                                 'conditions' => '', 
    15                                                                 'fields' => '', 
    16                                                                 'order' => '', 
    17                                                                 'counterCache' => ''), 
    18                         'Subject' => array('className' => 'Subject', 
    19                                                                 'foreignKey' => 'subject_id', 
    20                                                                 'conditions' => '', 
    21                                                                 'fields' => '', 
    22                                                                 'order' => '', 
    23                                                                 'counterCache' => ''), 
     12                        'User' => array('className' => 'User'), 
     13                        'Subject' => array('className' => 'Subject'), 
     14                        'Copyright' => array('className' => 'Copyright'), 
    2415        ); 
    2516 
     
    2920                                                'foreignKey' => 'video_id', 
    3021                                                'associationForeignKey' => 'tag_id', 
    31                                                 'conditions' => '', 
    32                                                 'fields' => '', 
    33                                                 'order' => '', 
    34                                                 'limit' => '', 
    35                                                 'offset' => '', 
    36                                                 'unique' => '', 
    37                                                 'finderQuery' => '', 
    38                                                 'deleteQuery' => '', 
    39                                                 'insertQuery' => ''), 
     22                                                'order' => 'Tag.tag ASC', 
     23                                                'unique' => true), 
    4024        ); 
    4125 
  • branch/views/events/admin_index.ctp

    r113 r118  
    7070                                </td> 
    7171                                <td> 
    72                                         <?php echo $event['Event']['published']?> 
     72                                        <?php e($webrocket->showPubStatus($event['Event']['published'])); ?> 
    7373                                </td> 
    7474                                <td> 
  • branch/views/pages/add.ctp

    r60 r118  
    22<h2>New Page</h2> 
    33        <?php echo $form->create('Page');?> 
    4                 <?php echo $form->input('url', array('class' => 'required'));?> 
    5                 <?php echo $form->input('title', array('class' => 'required'));?> 
    6                 <?php echo $form->input('body', array('class' => 'required'));?> 
    7                 <?php echo $form->input('published', array('class' => 'required'));?> 
    8                 <?php echo $form->input('user_id', array('class' => 'required', 'options' => $users));?> 
    9                 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
    10                 <?php echo $form->input('tags', array('class' => 'required'));?> 
    11                 <?php echo $form->input('Tag/Tag', array('options' => $tags, 'multiple' => 'multiple'));?> 
    12                 <?php echo $form->submit('Add');?> 
     4                <fieldset id="main-content"> 
     5                        <legend>Main Content</legend> 
     6                        <?php echo $form->input('title', array('class' => 'required'));?> 
     7                        <?php echo $form->input('body', array('class' => 'wymeditor'));?> 
     8                </fieldset> 
     9                 
     10                <fieldset id="meta-content"> 
     11                        <legend>Meta Data</legend> 
     12                        <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
     13                        <?php echo $form->input('tags', array('class' => 'tags', 'type'=>'text'));?> 
     14                </fieldset> 
     15                 
     16                <fieldset id="publishing-options"> 
     17                        <legend>Publishing Options</legend> 
     18                        <?php echo $form->input('published', array('class' => 'required'));?> 
     19                        <?php echo $form->input('access_level', array('class' => 'required', 'options'=>$access_levels));?> 
     20                </fielset> 
     21                 
     22                <?php echo $form->end('Add', array('class'=>'wymupdate'));?> 
    1323        </form> 
    1424</div> 
    15 <div class="actions"> 
    16         <ul> 
    17                 <li><?php echo $html->link('List Pages', array('action'=>'index')); ?></li> 
    18                 <li><?php echo $html->link('View Users', array('controller'=> 'users', 'action'=>'view'));?></li> 
    19                 <li><?php echo $html->link('Add Users', array('controller'=> 'users', 'action'=>'add')); ?></li> 
    20                 <li><?php echo $html->link('View Subjects', array('controller'=> 'subjects', 'action'=>'view'));?></li> 
    21                 <li><?php echo $html->link('Add Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?></li> 
    22         </ul> 
    23 </div> 
  • branch/views/pages/admin_add.ctp

    r68 r118  
    2020                </fielset> 
    2121                 
    22                 <?php echo $form->submit('Add', array('class'=>'wymupdate'));?> 
     22                <?php echo $form->end('Add', array('class'=>'wymupdate'));?> 
    2323        </form> 
    2424</div> 
  • branch/views/pages/admin_edit.ctp

    r68 r118  
    11<div class="page"> 
    2 <h2>Edit Page</h2> 
     2<h2>New Page</h2> 
    33        <?php echo $form->create('Page');?> 
    44                <fieldset id="main-content"> 
     
    2121                </fielset> 
    2222                 
    23                 <?php echo $form->submit('Add', array('class'=>'wymupdate'));?> 
    24                 <?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Page/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Page/id')); ?> 
     23                <?php echo $form->end('Update', array('class'=>'wymupdate'));?> 
    2524        </form> 
    2625</div> 
  • branch/views/pages/admin_index.ctp

    r60 r118  
    44         
    55        <table cellpadding="0" cellspacing="0"> 
     6                <thead> 
    67                <tr> 
    78                        <th><?php echo $paginator->sort('id');?></th> 
    89                        <th><?php echo $paginator->sort('title');?></th> 
    9                         <th><?php echo $paginator->sort('published');?></th> 
    10                         <th><?php echo $paginator->sort('user_id');?></th> 
    1110                        <th><?php echo $paginator->sort('subject_id');?></th> 
    1211                        <th><?php echo $paginator->sort('tags');?></th> 
     12                        <th><?php echo $paginator->sort('user_id');?></th> 
     13                        <th><?php echo $paginator->sort('published');?></th> 
    1314                        <th>Actions</th> 
    1415                </tr> 
     16        </thead> 
     17        <tbody> 
    1518        <?php foreach ($pages as $page): ?> 
    1619                <tr> 
    1720                        <td><?php echo $page['Page']['id']; ?></td> 
    1821                        <td><?php echo $page['Page']['title']; ?></td> 
    19                         <td><?php echo $page['Page']['published']; ?></td> 
    20                         <td><?php echo $html->link($page['User']['name'], array('controller'=> 'users', 'action'=>'view', $page['User']['id'])); ?></td> 
    2122                        <td><?php echo $html->link($page['Subject']['title'], array('controller'=> 'subjects', 'action'=>'view', $page['Subject']['id'])); ?></td> 
    2223                        <td><?php echo $page['Page']['tags']; ?></td> 
     24                        <td><?php echo $html->link($page['User']['name'], array('controller'=> 'users', 'action'=>'view', $page['User']['id'])); ?></td> 
     25                        <td><?php e($webrocket->showPubStatus($page['Page']['published'])); ?></td> 
    2326                        <td class="actions"> 
    2427                                <?php echo $html->link('View', array('action'=>'view', $page['Page']['id'])); ?> 
     
    2831                </tr> 
    2932        <?php endforeach; ?> 
     33        </tbody> 
    3034        </table> 
    3135         
    3236        </div> 
    3337        <div class="paging"> 
    34         <?php echo $paginator->prev('<< previous', array(), null, array('class'=>'previous disabled'));?> 
    35         | 
    36         <?php echo $paginator->next('next >>', array(), null, array('class'=>'next disabled'));?> 
     38        <?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> 
     39 |      <?php echo $paginator->numbers();?> 
     40        <?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> 
    3741        </div> 
    3842<?php } else { ?> 
  • branch/views/pages/admin_view.ctp

    r60 r118  
    1 <div class="page"> 
    2 <h2>View Page</h2> 
    3  
    4         <dl> 
    5                 <dt>Id</dt> 
    6                 <dd>&nbsp;<?php echo $page['Page']['id']?></dd> 
    7                 <dt>Url</dt> 
    8                 <dd>&nbsp;<?php echo $page['Page']['url']?></dd> 
    9                 <dt>Title</dt> 
    10                 <dd>&nbsp;<?php echo $page['Page']['title']?></dd> 
    11                 <dt>Body</dt> 
    12                 <dd>&nbsp;<?php echo $page['Page']['body']?></dd> 
    13                 <dt>Published</dt> 
    14                 <dd>&nbsp;<?php echo $page['Page']['published']?></dd> 
    15                 <dt>User</dt> 
    16                 <dd>&nbsp;<?php echo $html->link($page['User']['name'], array('controller'=> 'users', 'action'=>'view', $page['User']['id'])); ?></dd> 
    17                 <dt>Subject</dt> 
    18                 <dd>&nbsp;<?php echo $html->link($page['Subject']['title'], array('controller'=> 'subjects', 'action'=>'view', $page['Subject']['id'])); ?></dd> 
    19                 <dt>Tags</dt> 
    20                 <dd>&nbsp;<?php echo $page['Page']['tags']?></dd> 
    21         </dl> 
     1<div class="hentry"> 
     2        <h2 class="entry-title"><?php e($html->link($page['Page']['title'], array('controller'=>'posts', 'action'=>'view', $page['Page']['slug']))); ?></h2> 
     3        <?php echo $html->link('Edit', array('action'=>'edit', $page['Page']['id'])); ?> 
     4        <abbr class="updated" title=""><?php echo $page['Page']['modified']; ?></abbr> 
     5        <span class="vcard author"><?php echo $html->link($page['User']['username'], array('controller'=> 'users', 'action'=>'view', $page['User']['id'])); ?></span> 
     6        <div class="entry-content"> 
     7                <?php echo $page['Page']['body']; ?> 
     8        </div>   
     9        <div class="meta"> 
     10                Comments: <?php echo $page['Page']['comments_count']; ?><br /> 
     11                Tags: <?php foreach ($page['Tag'] as $tag) : 
     12                                        e($html->link($tag['tag'], 'http://technorati.com/tag/' . $tag['tag'], array('rel'=>'tag', 'class'=>'tag')));  
     13                                        endforeach;                              
     14                                ?> 
     15        </div> 
     16        <span class="version" style="display: none;">0.3</span> 
    2217</div> 
    23 <div class="actions"> 
    24         <ul> 
    25                 <li><?php echo $html->link('Edit Page',   array('action'=>'edit', $page['Page']['id'])); ?> </li> 
    26                 <li><?php echo $html->link('Delete Page', array('action'=>'delete', $page['Page']['id']), null, 'Are you sure you want to delete #' . $page['Page']['id'] . '?'); ?> </li> 
    27                 <li><?php echo $html->link('List Pages', array('action'=>'index')); ?> </li> 
    28                 <li><?php echo $html->link('New Page', array('action'=>'add')); ?> </li> 
    29                 <li><?php echo $html->link('List User', array('controller'=> 'users', 'action'=>'index')); ?> </li> 
    30                 <li><?php echo $html->link('New Users', array('controller'=> 'users', 'action'=>'add')); ?> </li> 
    31                 <li><?php echo $html->link('List Subject', array('controller'=> 'subjects', 'action'=>'index')); ?> </li> 
    32                 <li><?php echo $html->link('New Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?> </li> 
    33         </ul> 
    34  
    35 </div> 
    36 <div class="related"> 
    37 <h3>Related Tags</h3> 
    38 <?php if(!empty($page['Tag'])):?> 
    39 <table cellpadding="0" cellspacing="0"> 
    40         <tr> 
    41                 <th>Id</th> 
    42                 <th>Tag</th> 
    43                 <th>Actions</th> 
    44         </tr> 
    45 <?php foreach($page['Tag'] as $tag):?> 
    46         <tr> 
    47                 <td><?php echo $tag['id'];?></td> 
    48                 <td><?php echo $tag['tag'];?></td> 
    49                 <td class="actions"> 
    50                         <?php echo $html->link('View', array('controller'=> 'tags', 'action'=>'view', $tag['id'])); ?> 
    51                         <?php echo $html->link('Edit', array('controller'=> 'tags', 'action'=>'edit', $tag['id'])); ?> 
    52                         <?php echo $html->link('Delete', array('controller'=> 'tags', 'action'=>'delete', $tag['id']), null, 'Are you sure you want to delete #' . $tag['id'] . '?'); ?> 
    53                 </td> 
    54         </tr> 
    55 <?php endforeach; ?> 
    56 </table> 
    57 <?php endif; ?> 
    58  
    59         <div class="actions"> 
    60                 <ul> 
    61                         <li><?php echo $html->link('New Tag', array('controller'=> 'tags', 'action'=>'add'));?> </li> 
    62                 </ul> 
    63         </div> 
    64 </div> 
  • branch/views/pages/edit.ctp

    r60 r118  
    11<div class="page"> 
    2 <h2>Edit Page</h2> 
     2<h2>New Page</h2> 
    33        <?php echo $form->create('Page');?> 
    4                 <?php echo $form->input('id');?> 
    5                 <?php echo $form->input('url', array('class' => 'required'));?> 
    6                 <?php echo $form->input('title', array('class' => 'required'));?> 
    7                 <?php echo $form->input('body', array('class' => 'required'));?> 
    8                 <?php echo $form->input('published', array('class' => 'required'));?> 
    9                 <?php echo $form->input('user_id', array('class' => 'required', 'options' => $users));?> 
    10                 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
    11                 <?php echo $form->input('tags', array('class' => 'required'));?> 
    12                 <?php echo $form->input('Tag/Tag', array('options' => $tags, 'multiple' => 'multiple'));?> 
    13                 <?php echo $form->submit('Update');?> 
     4                <fieldset id="main-content"> 
     5                        <legend>Main Content</legend> 
     6                        <?php echo $form->input('id');?> 
     7                        <?php echo $form->input('title', array('class' => 'required'));?> 
     8                        <?php echo $form->input('body', array('class' => 'wymeditor'));?> 
     9                </fieldset> 
     10                 
     11                <fieldset id="meta-content"> 
     12                        <legend>Meta Data</legend> 
     13                        <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
     14                        <?php echo $form->input('tags', array('class' => 'tags', 'type'=>'text'));?> 
     15                </fieldset> 
     16                 
     17                <fieldset id="publishing-options"> 
     18                        <legend>Publishing Options</legend> 
     19                        <?php echo $form->input('published', array('class' => 'required'));?> 
     20                        <?php echo $form->input('access_level', array('class' => 'required', 'options'=>$access_levels));?> 
     21                </fielset> 
     22                 
     23                <?php echo $form->end('Update', array('class'=>'wymupdate'));?> 
    1424        </form> 
    1525</div> 
    16 <div class="actions"> 
    17         <ul> 
    18                 <li><?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Page/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Page/id')); ?> 
    19                 <li><?php echo $html->link('List Pages', array('action'=>'index')); ?></li> 
    20                 <li><?php echo $html->link('View Users', array('controller'=> 'users', 'action'=>'view')); ?></li> 
    21                 <li><?php echo $html->link('Add Users', array('controller'=> 'users', 'action'=>'add')); ?></li> 
    22                 <li><?php echo $html->link('View Subjects', array('controller'=> 'subjects', 'action'=>'view')); ?></li> 
    23                 <li><?php echo $html->link('Add Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?></li> 
    24         </ul> 
    25 </div> 
  • branch/views/pages/index.ctp

    r60 r118  
    1 <div class="pages"> 
    2 <h2>List Pages</h2> 
    3  
    4 <table cellpadding="0" cellspacing="0"> 
    5         <tr> 
    6                 <th><?php echo $paginator->sort('id');?></th> 
    7                 <th><?php echo $paginator->sort('url');?></th> 
    8                 <th><?php echo $paginator->sort('title');?></th> 
    9                 <th><?php echo $paginator->sort('body');?></th> 
    10                 <th><?php echo $paginator->sort('published');?></th> 
    11                 <th><?php echo $paginator->sort('user_id');?></th> 
    12                 <th><?php echo $paginator->sort('subject_id');?></th> 
    13                 <th><?php echo $paginator->sort('tags');?></th> 
    14                 <th>Actions</th> 
    15         </tr> 
    16 <?php foreach ($pages as $page): ?> 
    17         <tr> 
    18                 <td><?php echo $page['Page']['id']; ?></td> 
    19                 <td><?php echo $page['Page']['url']; ?></td> 
    20                 <td><?php echo $page['Page']['title']; ?></td> 
    21                 <td><?php echo $page['Page']['body']; ?></td> 
    22                 <td><?php echo $page['Page']['published']; ?></td> 
    23                 <td><?php echo $html->link($page['User']['name'], array('controller'=> 'users', 'action'=>'view', $page['User']['id'])); ?></td> 
    24                 <td><?php echo $html->link($page['Subject']['title'], array('controller'=> 'subjects', 'action'=>'view', $page['Subject']['id'])); ?></td> 
    25                 <td><?php echo $page['Page']['tags']; ?></td> 
    26                 <td class="actions"> 
    27                         <?php echo $html->link('View', array('action'=>'view', $page['Page']['id'])); ?> 
    28                         <?php echo $html->link('Edit', array('action'=>'edit', $page['Page']['id'])); ?> 
    29                         <?php echo $html->link('Delete', array('action'=>'delete', $page['Page']['id']), null, 'Are you sure you want to delete #' . $page['Page']['id']); ?> 
    30                 </td> 
    31         </tr> 
    32 <?php endforeach; ?> 
    33 </table> 
    34  
    35 </div> 
    36 <div class="paging"> 
    37 <?php echo $paginator->prev('<< previous', array(), null, array('class'=>'disabled'));?> 
    38 
    39 <?php echo $paginator->next('next >>', array(), null, array('class'=>'disabled'));?> 
    40 </div> 
     1<?php if ($pages) { ?> 
     2        <div class="pages"> 
     3        <h2>List Pages</h2> 
     4         
     5        <table cellpadding="0" cellspacing="0"> 
     6                <thead> 
     7                <tr> 
     8                        <th><?php echo $paginator->sort('id');?></th> 
     9                        <th><?php echo $paginator->sort('title');?></th> 
     10                        <th><?php echo $paginator->sort('subject_id');?></th> 
     11                        <th><?php echo $paginator->sort('tags');?></th> 
     12                        <th><?php echo $paginator->sort('user_id');?></th> 
     13                        <th><?php echo $paginator->sort('published');?></th> 
     14                        <th>Actions</th> 
     15                </tr> 
     16        </thead> 
     17        <tbody> 
     18        <?php foreach ($pages as $page): ?> 
     19                <tr> 
     20                        <td><?php echo $page['Page']['id']; ?></td> 
     21                        <td><?php echo $page['Page']['title']; ?></td> 
     22                        <td><?php echo $html->link($page['Subject']['title'], array('controller'=> 'subjects', 'action'=>'view', $page['Subject']['id'])); ?></td> 
     23                        <td><?php echo $page['Page']['tags']; ?></td> 
     24                        <td><?php echo $html->link($page['User']['name'], array('controller'=> 'users', 'action'=>'view', $page['User']['id'])); ?></td> 
     25                        <td><?php e($webrocket->showPubStatus($page['Page']['published'])); ?></td> 
     26                        <td class="actions"> 
     27                                <?php echo $html->link('View', array('action'=>'view', $page['Page']['id'])); ?> 
     28                                <?php echo $html->link('Edit', array('action'=>'edit', $page['Page']['id'])); ?> 
     29                                <?php echo $html->link('Delete', array('action'=>'delete', $page['Page']['id']), null, 'Are you sure you want to delete #' . $page['Page']['id']); ?> 
     30                        </td> 
     31                </tr> 
     32        <?php endforeach; ?> 
     33        </tbody> 
     34        </table> 
     35         
     36        </div> 
     37        <div class="paging"> 
     38        <?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> 
     39 |      <?php echo $paginator->numbers();?> 
     40        <?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> 
     41        </div> 
     42<?php } else { ?> 
     43        <h2>There are currently no pages. Click <?php echo $html->link('here', array('action'=>'add')); ?> to create one.</h2> 
     44<?php } ?> 
    4145<div class="actions"> 
    4246        <ul> 
  • branch/views/pages/view.ctp

    r60 r118  
     1<?php pr($page);?> 
     2 
    13<div class="hentry"> 
    2                 <h2 class="entry-title"><?php e($html->link($page['Page']['title'], array('controller'=>'posts', 'action'=>'view', $page['Page']['stub']))); ?></h2> 
    3                 <?php echo $html->link('Edit', array('action'=>'edit', $page['Page']['id'])); ?> 
    4                 <abbr class="updated" title=""><?php echo $page['Page']['modified']; ?></abbr> 
    5                 <span class="vcard author"><?php echo $html->link($page['User']['username'], array('controller'=> 'users', 'action'=>'view', $page['User']['id'])); ?></span> 
    6                 <div class="entry-content"> 
    7                         <?php echo $page['Page']['body']; ?> 
    8                 </div> 
    9                  
    10                 <div class="meta"> 
    11                         Comments: <?php echo $