Show
Ignore:
Timestamp:
07/21/08 19:18:07 (4 months ago)
Author:
sidtheduck
Message:

+ Fix for ticket #160 - cruft-free pagination
+ Couple of miscellaneous syntax edits

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plog-admin/plog-feedback.php

    r555 r563  
    110110$url = "?entries_per_page=$_SESSION[entries_per_page]"; 
    111111 
    112 $first_item = ($_REQUEST['plog_page'] - 1) * $_SESSION['entries_per_page']; 
     112$plog_page = isset($_REQUEST["plog_page"]) ? $_REQUEST["plog_page"] : 1; 
     113 
     114$first_item = ($plog_page - 1) * $_SESSION['entries_per_page']; 
    113115$limit = "LIMIT $first_item, $_SESSION[entries_per_page]"; 
    114116 
     
    122124$num_comments_im = mysql_result($mod_result, "in_moderation"); 
    123125 
    124 $page = isset($_GET["plog_page"]) ? $_GET["plog_page"] : 1; 
    125  
    126126// filter based on whether were looking at approved comments or unmoderated comments 
    127 $approved = isset($_GET["moderate"]) ? 0 : 1; 
    128  
    129 if ($approved) 
    130         $pagination_menu = generate_pagination('plog-feedback.php'.$url,$page,$num_comments,$_SESSION['entries_per_page']); 
    131 else 
    132         $pagination_menu = generate_pagination('plog-feedback.php'.$url,$page,$num_comments_im,$_SESSION['entries_per_page'],"&moderate=1"); 
     127$approved = isset($_REQUEST['moderate']) ? 0 : 1; 
     128 
     129if ($approved) { 
     130        $pagination_menu = generate_pagination("admin", "feedback", $plog_page, $num_comments, $_SESSION['entries_per_page']); 
     131} else { 
     132        $pagination_menu = generate_pagination("admin", "feedback", $plog_page, $num_comments_im, $_SESSION['entries_per_page'], array("moderate" => 1)); 
     133} 
     134$pagination_menu = "\n\t\t" . '<div class="pagination">'.$pagination_menu.'</div>'; 
    133135 
    134136// generate javascript init function for ajax editing 
     
    186188                </table>'; 
    187189 
     190                        if (!$empty) { $output .= $pagination_menu; } 
     191 
    188192                        $output .= "\n\n\t\t" . '<table style="width: 100%;" cellpadding="4"> 
    189193                        <tr class="header"> 
     
    269273} 
    270274 
    271 if (!$empty) 
    272         $output .= "\n\n\t\t" . '<table style="width: 100%;"> 
    273                         <tr> 
    274                                 <td><a href="#" onclick="checkAll(document.getElementById(\'contentList\')); return false;">' . plog_tr('Invert Checkbox Selection') . '</a></td> 
    275                                 <td align="right">'.$pagination_menu.'</td> 
    276                         </tr> 
    277                 </table>'; 
    278  
    279 $output .= "\n\n\t\t" . '<div><input class="submit" type="submit" name="delete_checked" onclick="return confirm(\''. plog_tr('Are you sure you want to delete the selected comments?') . '\');" value="' . plog_tr('Delete Checked') . '" /><input class="submit" type="submit" name="approve_checked" onclick="return confirm(\'' . plog_tr('Are you sure you want to approve the selected comments?') . '\');" value="' . plog_tr('Approve Checked') . '" /></div>'; 
     275if (!$empty) { 
     276        $output .= "\n\n\t\t" . '<div><a href="#" onclick="checkAll(document.getElementById(\'contentList\')); return false;">' . plog_tr('Invert Checkbox Selection') . '</a></div> 
     277                '.$pagination_menu; 
     278} 
     279 
     280$output .= "\n\n\t\t" . '<div><input class="submit" type="submit" name="delete_checked" onclick="return confirm(\''. plog_tr('Are you sure you want to delete the selected comments?') . '\');" value="' . plog_tr('Delete Checked') . '" />'; 
     281if (!$approved) { 
     282        $output .= '<input class="submit" type="submit" name="approve_checked" onclick="return confirm(\'' . plog_tr('Are you sure you want to approve the selected comments?') . '\');" value="' . plog_tr('Approve Checked') . '" /></div>'; 
     283} 
    280284 
    281285$output .= "\n\n\t\t" . '</form>'. "\n";