Ticket #291: 2005-10-01_sort_results.diff

File 2005-10-01_sort_results.diff, 6.0 KB (added by Adam Di Carlo <aph@…>, 14 years ago)
  • mythweb/themes/Default/recorded_programs.php

     
    9494    $group_field = "";
    9595}
    9696
     97// specify some state which should be retained
     98$page_state_list = array();
     99$page_state = "";
     100if ($_GET['recgroup']) {
     101   $page_state_list[] = "recgroup=" . urlencode($_GET['recgroup']);
     102}
     103if ($_GET['title']) {
     104   $page_state_list[] = "title=" . urlencode($_GET['title']);
     105}
     106$page_state = implode('&', $page_state_list);
     107
    97108?>
    98109
    99110<table width="100%" border="0" cellpadding="4" cellspacing="2" class="list small">
     
    104115    if (show_recorded_pixmaps)
    105116        echo "\t<td>".t('preview')."</td>\n";
    106117?>
    107     <td><?php echo get_sort_link('title',    t('title'))    ?></td>
    108     <td><?php echo get_sort_link('subtitle', t('subtitle')) ?></td>
     118    <td><?php echo get_sort_link('title',    t('title'), $page_state)    ?></td>
     119    <td><?php echo get_sort_link('subtitle', t('subtitle'), $page_state) ?></td>
    109120<?php
    110121    if (!$_SESSION['recorded_descunder'])
    111         echo "\t<td>".get_sort_link('description', t('description'))."</td>\n";
     122        echo "\t<td>".get_sort_link('description', t('description'), $page_state)."</td>\n";
    112123?>
    113     <td><?php echo get_sort_link('channum',   t('channum'))  ?></td>
    114     <td><?php echo get_sort_link('recgroup',  t('recgroup'))  ?></td>
    115     <td><?php echo get_sort_link('airdate',   t('airdate'))  ?></td>
    116     <td><?php echo get_sort_link('length',    t('length'))   ?></td>
    117     <td><?php echo get_sort_link('file_size', t('file size')) ?></td>
     124    <td><?php echo get_sort_link('channum',   t('channum'), $page_state)  ?></td>
     125    <td><?php echo get_sort_link('recgroup',  t('recgroup'), $page_state)  ?></td>
     126    <td><?php echo get_sort_link('airdate',   t('airdate'), $page_state)  ?></td>
     127    <td><?php echo get_sort_link('length',    t('length'), $page_state)   ?></td>
     128    <td><?php echo get_sort_link('file_size', t('file size'), $page_state) ?></td>
    118129</tr><?php
    119130    $row = 0;
    120131
  • mythweb/themes/Default/scheduled_recordings.php

     
    2828
    2929<div id="display_options" class="command command_border_l command_border_t command_border_b command_border_r">
    3030
    31     <form id="change_display" action="scheduled_recordings.php" method="post">
    32     <input type="hidden" name="change_display" value="1">
     31    <form id="change_display" action="scheduled_recordings.php" method="get">
    3332
    3433    <?php echo t('Display') ?>:
    3534
     
    5554
    5655<table id="listings" width="100%" border="0" cellpadding="4" cellspacing="2" class="list small">
    5756<tr class="menu">
    58     <?php if ($group_field != '') echo "<td class=\"list\">&nbsp;</td>\n"; ?>
    59     <td><?php echo get_sort_link('title',   t('title'))   ?></td>
    60     <td><?php echo get_sort_link('channum', t('channum')) ?></td>
    61     <td><?php echo get_sort_link('airdate', t('airdate')) ?></td>
    62     <td><?php echo get_sort_link('length',  t('length'))  ?></td>
     57<?php
     58if ($group_field != '') echo "<td class=\"list\">&nbsp;</td>\n";
     59
     60// page state to preserve
     61$page_state_list = array();
     62$page_state = "";
     63$session_stateful_fields = array('disp_scheduled', 'disp_duplicates', 'disp_deactivated', 'disp_conflicts');
     64foreach ($session_stateful_fields as $s) {
     65    if ($_SESSION['scheduled_recordings'][$s]) {
     66        $page_state_list[] = "$s=on";
     67    }
     68}
     69$page_state = implode('&', $page_state_list);
     70       
     71?>
     72    <td><?php echo get_sort_link('title',   t('title'),   $page_state)   ?></td>
     73    <td><?php echo get_sort_link('channum', t('channum'), $page_state) ?></td>
     74    <td><?php echo get_sort_link('airdate', t('airdate'), $page_state) ?></td>
     75    <td><?php echo get_sort_link('length',  t('length'),  $page_state)  ?></td>
    6376    <td align="center" colspan="2"><?php echo t('Commands') ?></a></td>
    6477</tr><?php
    6578    $row = 0;
  • mythweb/scheduled_recordings.php

     
    4848    }
    4949
    5050// Ignore certain shows?
    51     if ($_POST['change_display']) {
    52         $_SESSION['scheduled_recordings']['disp_scheduled']   = $_POST['disp_scheduled']   ? true : false;
    53         $_SESSION['scheduled_recordings']['disp_duplicates']  = $_POST['disp_duplicates']  ? true : false;
    54         $_SESSION['scheduled_recordings']['disp_deactivated'] = $_POST['disp_deactivated'] ? true : false;
    55         $_SESSION['scheduled_recordings']['disp_conflicts']   = $_POST['disp_conflicts']   ? true : false;
    56     }
     51    $_SESSION['scheduled_recordings']['disp_scheduled']   = $_REQUEST['disp_scheduled']   ? true : false;
     52    $_SESSION['scheduled_recordings']['disp_duplicates']  = $_REQUEST['disp_duplicates']  ? true : false;
     53    $_SESSION['scheduled_recordings']['disp_deactivated'] = $_REQUEST['disp_deactivated'] ? true : false;
     54    $_SESSION['scheduled_recordings']['disp_conflicts']   = $_REQUEST['disp_conflicts']   ? true : false;
    5755
    5856// Defaults
    5957    if (!is_array($_SESSION['scheduled_recordings'])
  • mythweb/includes/sorting.php

     
    1212    get_sort_link:
    1313    returns a formatted link to the specified sort field
    1414*/
    15     function get_sort_link($field, $string) {
     15    function get_sort_link($field, $string, $addl = NULL) {
    1616        $status = sort_status($field);
    17         $link = '<a href="'.$_SERVER['PHP_SELF'].'?sortby='.urlencode($field).'">'
     17        $link = '<a href="'.$_SERVER['PHP_SELF'].'?'
     18               .($addl ? $addl . '&' : '')
     19               .'sortby='.urlencode($field).'">'
    1820               .$string
    1921               .'</a>';
    2022        if ($status == 1)