Ticket #1268: search_override.patch

File search_override.patch, 6.6 KB (added by derek@…, 18 years ago)

Allow overrides for search based recording rules

  • themes/default/tv/detail.php

     
    300300                        else
    301301                            echo t('Don\'t record this program.');
    302302                        ?></a></li>
    303 
     303 <?php       if(empty($schedule->search)) { ?>
    304304                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_once ?>" id="record_once"<?php
    305305                        echo $schedule->type == rectype_once ? ' CHECKED' : '' ?> />
    306306                    <a onclick="get_element('record_once').checked=true;"><?php echo t('rectype-long: once') ?></a></li>
    307 
    308 <?php       if (empty($schedule->search)) { ?>
    309307                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_daily ?>" id="record_daily"<?php
    310308                        echo $schedule->type == rectype_daily ? ' CHECKED' : '' ?> />
    311309                    <a onclick="get_element('record_daily').checked=true;"><?php echo t('rectype-long: daily') ?></a></li>
     
    313311                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_weekly ?>" id="record_weekly"<?php
    314312                        echo $schedule->type == rectype_weekly ? ' CHECKED' : '' ?> />
    315313                    <a onclick="get_element('record_weekly').checked=true;"><?php echo t('rectype-long: weekly') ?></a></li>
    316 
     314<?php       } ?>
    317315                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_findone ?>" id="record_findone"<?php
    318316                        echo $schedule->type == rectype_findone ? ' CHECKED' : '' ?> />
    319317                    <a onclick="get_element('record_findone').checked=true;"><?php echo t('rectype-long: findone') ?></a></li>
     
    325323                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_findweekly ?>" id="record_findweekly"<?php
    326324                        echo $schedule->type == rectype_findweekly ? ' CHECKED' : '' ?> />
    327325                    <a onclick="get_element('record_findweekly').checked=true;"><?php echo t('rectype-long: findweekly') ?></a></li>
    328 
     326 <?php       if(empty($schedule->search)) { ?>
    329327                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_channel ?>" id="record_channel"<?php
    330328                        echo $schedule->type == rectype_channel ? ' CHECKED' : '' ?> />
    331329                    <a onclick="get_element('record_channel').checked=true;"><?php echo t('rectype-long: channel', prefer_channum ? $channel->channum : $channel->callsign) ?></a></li>
    332 
     330<?php       } ?>
    333331                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_always ?>" id="record_always"<?php
    334332                        echo $schedule->type == rectype_always ? ' CHECKED' : '' ?> />
    335333                    <a onclick="get_element('record_always').checked=true;"><?php echo t('rectype-long: always') ?></a></li>
    336 <?php       } ?>
    337334            </ul>
    338335        </div>
    339336<?php
  • includes/recording_schedules.php

     
    138138    var $findtime;
    139139    var $findid;
    140140    var $transcoder;
     141    var $parentid;
    141142
    142143    var $texttype;
    143144    var $channel;
     
    246247    // Update the type, in case it changed
    247248        $this->type = $new_type;
    248249    // Update the record
    249         $result = mysql_query('REPLACE INTO record (recordid,type,chanid,starttime,startdate,endtime,enddate,search,title,subtitle,description,profile,recpriority,category,maxnewest,inactive,maxepisodes,autoexpire,startoffset,endoffset,recgroup,dupmethod,dupin,station,seriesid,programid,autocommflag,findday,findtime,findid,autotranscode,transcoder,tsdefault,autouserjob1,autouserjob2,autouserjob3,autouserjob4) values ('
     250        $result = mysql_query('REPLACE INTO record (recordid,type,chanid,starttime,startdate,endtime,enddate,search,title,subtitle,description,profile,recpriority,category,maxnewest,inactive,maxepisodes,autoexpire,startoffset,endoffset,recgroup,dupmethod,dupin,station,seriesid,programid,autocommflag,findday,findtime,findid,autotranscode,transcoder,tsdefault,autouserjob1,autouserjob2,autouserjob3,autouserjob4,parentid) values ('
    250251                                .escape($this->recordid, true)             .','
    251252                                .escape($this->type)                       .','
    252253                                .escape($this->chanid)                     .','
     
    283284                                .escape($this->autouserjob1)               .','
    284285                                .escape($this->autouserjob2)               .','
    285286                                .escape($this->autouserjob3)               .','
    286                                 .escape($this->autouserjob4)               .')')
     287                                .escape($this->autouserjob4)               .','
     288                                .escape($this->parentid)                   .')')
    287289            or trigger_error('SQL Error: '.mysql_error(), FATAL);
    288290    // Get the id that was returned
    289291        $recordid = mysql_insert_id();
  • modules/tv/detail.php

     
    4040        $schedule = new Schedule(NULL);
    4141
    4242// Handle custom search schedules
    43     $schedule_note = '';
    44     if ($schedule->search && $schedule->search != searchtype_manual) {
    45         $schedule_note = t('This program is already scheduled to be recorded via a $1custom search$2.',
    46                            '<a href='.root.'tv/schedules/custom/'.$schedule->recordid.'>',
    47                            '</a>');
    48         unset($schedule);
    49     }
     43    $schedule_note = ''; // Don't think it's needed; but leaving just in case
    5044
    5145// Make sure this is a valid program.  If not, forward the user back to the listings page
    5246    if (!strlen($program->starttime) && !$schedule->recordid) {
     
    132126            $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
    133127            $schedule->transcoder    = $_POST['transcoder'];
    134128            $schedule->tsdefault     = $_POST['timestretch'];
     129            if($_POST['record'] == rectype_override) {
     130                $schedule->parentid  = $schedule->recid;
     131                $schedule->search = 0;
     132            }
     133                   
    135134        // Back up the program type, and save the schedule
    136135            $schedule->save($type);
    137136        }