Plugin Directory

Changeset 229768


Ignore:
Timestamp:
04/16/2010 02:52:44 AM (16 years ago)
Author:
mgolawala
Message:

Began working on pagination

Location:
wp-category-manager/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-category-manager/trunk/categorymanagerfunctions.php

    r228737 r229768  
    11<?php
    22/*
    3  * To change this template, choose Tools | Templates
    4  * and open the template in the editor.
     3 * This file defines the set of functions used by the wp-category-manager plugin to perform its actual operations
    54 */
    65
     6/*
     7 * This function removes the category identified by $categoryId from the post identified by $postId
     8 */
    79function removeCategoryFromPost($postId, $categoryId)
    810{
     
    1517}
    1618
    17 function getPostListForCat($category)
     19/*
     20 * This function returns a list of posts that belong to a category identified by $category.
     21 * The optional Page parameter defines how many pages of posts to return
     22 */
     23function getPostListForCat($category, $page, $postsPerPage)
    1824{
    1925    global $wpdb;
     
    2733                    WHERE wp_term_taxonomy.taxonomy = 'category'
    2834                            and wp_terms.name = '" . $category . "'
    29                             and wposts.post_status='publish'";
     35                            and wposts.post_status='publish'
     36        ORDER BY wposts.ID limit 3 offset 3";
    3037
    3138     $postlist = $wpdb->get_results($querystr);
  • wp-category-manager/trunk/manage-category.php

    r229763 r229768  
    3333{
    3434    //var_dump($_GET['category']);
    35     renderPosts(getPostListForCat($_GET['category']));
     35    renderPosts(getPostListForCat($_GET['category'], 0 , 10));
    3636}
    3737
  • wp-category-manager/trunk/wp-category-manager-settings.php

    r228737 r229768  
    11<div class="wrap" style="max-width:950px !important;">
    22    <h2>Category Manager</h2>
    3                
     3
    44    <div id="poststuff" style="margin-top:10px;">
    55
    66     <div id="mainblock" style="width:710px">
    7              
     7
    88        <div class="dbx-content">
    9             <form name="CatManager" action="<?php echo $action_url ?>" method="post">
    10                     <input type="hidden" name="submitted" value="1" />
    11                    
    12                     <?php wp_nonce_field('catmanager-nonce'); ?>
    13                    
    14                     <h3>Usage</h3>     
    15                     <p>This plugin makes category management quicker. Especially if you modify post categories often after posting them </p>
    16                     <br />
    17                    
    18                     <h3>Options</h3>
    19                     <p>You can choose whether you want the category management widget shows up on the dashboard</p>
    20                     <input type="checkbox" name="ondashboard"  <?php echo $ondash ?> /><label for="posts"> Show On Dashboard</label>  <br />
    21                     <br />                                         
    22                    
    23                                         <p>You can choose whether you want the category management widget to diplay a confirmation prompt on category removal</p>
    24                     <input type="checkbox" name="showConfirm"  <?php echo $showConfirm ?> /><label for="posts"> Enable Confirmation dialog</label>  <br />
    25                     <br />
     9            <form name="CatManager" action="<?php echo $action_url ?>" method="post">
     10            <input type="hidden" name="submitted" value="1" />
    2611
    27                                         <p>If you want to be able to change the selected default category on the dashboard without coming to this screen enable the option below</p>
    28                     <input type="checkbox" name="enableDropdown"  <?php echo $enableDropdown ?> /><label for="posts"> Enable Category drown down list</label>  <br />
    29                     <br />
     12            <?php wp_nonce_field('catmanager-nonce'); ?>
     13
     14            <h3>Usage</h3>
     15            <p>This plugin makes category management quicker. Especially if you modify post categories often after posting them </p>
     16            <br />
     17
     18            <h3>Options</h3>
     19            <p>You can choose whether you want the category management widget shows up on the dashboard</p>
     20            <input type="checkbox" name="ondashboard"  <?php echo $ondash ?> /><label> Show On Dashboard</label>  <br />
     21            <br />
     22
     23            <p>You can choose whether you want the category management widget to diplay a confirmation prompt on category removal</p>
     24            <input type="checkbox" name="showConfirm"  <?php echo $showConfirm ?> /><label> Enable Confirmation dialog</label>  <br />
     25            <br />
     26
     27            <p>If you want to be able to change the selected default category on the dashboard without coming to this screen enable the option below</p>
     28            <input type="checkbox" name="enableDropdown"  <?php echo $enableDropdown ?> /><label> Enable Category drown down list</label>  <br />
     29            <br />
     30
     31            <h3> Posts Per Page </h3><label>Show :&nbsp;</label><?php echo $ppplist; ?><br />
     32            <br />
    3033
    3134
    32                     <h3>Default Category</h3>   
    33                     <p>You can specify the default category you wish to show up on the dashboard widget</p>
     35            <h3>Default Category</h3>
     36            <p>You can specify the default category you wish to show up on the dashboard widget</p>
    3437
    3538
    36                     <?php echo $selectlist; ?>
    37                                                                            
    38                     <div class="submit"><input type="submit" name="Submit" value="Update" /></div>
     39            <?php echo $selectlist; ?>
     40
     41
     42
     43            <div class="submit"><input type="submit" name="Submit" value="Update" /></div>
    3944            </form>
    4045        </div>
    41                
     46
    4247     </div>
    4348
    4449    </div>
    45    
     50
    4651</div>
  • wp-category-manager/trunk/wp-category-manager.php

    r229766 r229768  
    4646       
    4747             $options = get_option($this->db_option);
    48              $postlist = getPostListForCat($options['defaultCategory']);
     48             $postlist = getPostListForCat($options['defaultCategory'], 0, $options['postsperpage']);
    4949             
    5050             if($options['enableDropdown'] == 'on')
     
    8383                        'showConfirm' => 'on',
    8484            'defaultCategory' => '',
     85            'postsperpage' => 10,
    8586                        'enableDropdown' => 'on'
    8687        );
     
    104105    }
    105106
     107    function getPostsPerPageSelectBox()
     108    {
     109        $options = $this->get_options();
     110        $pageOptions = array(-1,5,10,25,50);
     111        $postsPerPage = $options['postsperpage'];
     112
     113        $selectlist = '<select name="postsperpage">';
     114
     115        foreach($pageOptions as $option)
     116        {
     117            $txt = $option==-1? 'Unlimited' : $option;
     118            if($option == $postsPerPage)
     119            {
     120                $selectlist = $selectlist . '<option value="' . $option . '" selected>' . $txt . '</option>';
     121            }
     122            else
     123            {
     124                $selectlist = $selectlist . '<option value="' . $option . '" >' . $txt . '</option>';
     125            }
     126        }
     127        $selectlist = $selectlist . '</select>';
     128
     129        return $selectlist;
     130
     131    }
    106132       
    107133
     
    146172                    $options['showConfirm'] = $_POST['showConfirm'];
    147173                    $options['defaultCategory'] = $_POST['defaultCat'];
     174            $options['postsperpage'] = $_POST['postsperpage'];
    148175                    $options['enableDropdown'] = $_POST['enableDropdown'];
    149176
     
    156183            $showConfirm = $options['showConfirm']=='on' ? 'checked' : '';
    157184            $defaultCat = $options['defaultCategory'];
     185        $postsPerPage = $options['postperpage'];
    158186            $enableDropdown = $options['enableDropdown']=='on' ? 'checked' : '';;
    159187
    160188            $action_url = $_SERVER['REQUEST_URI'];
    161189
     190        $ppplist = $this->getPostsPerPageSelectBox();
    162191            $selectlist = $this->getCatSelectBox();
    163192
     193       
    164194            include('wp-category-manager-settings.php');
    165195           
Note: See TracChangeset for help on using the changeset viewer.