Ticket #1144: custom_record.2.patch

File custom_record.2.patch, 7.8 KB (added by derek@…, 18 years ago)

Increased functionality for custom record schedules; fix for 1118

  • themes/default/tv/schedules_custom.php

     
    7171                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_always ?>" id="record_always"<?php
    7272                        if ($schedule->type == rectype_always) echo ' CHECKED' ?> />
    7373                    <label for="record_always"><?php echo t('rectype-long: always') ?></label></li>
     74                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_finddaily ?>" id="rectype_finddaily"<?php
     75                        if ($schedule->type == rectype_finddaily) echo ' CHECKED' ?> />
     76                    <label for="rectype_finddaily"><?php echo t('rectype-long: finddaily') ?></label></li>
     77                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_findweekly ?>" id="rectype_findweekly"<?php
     78                        if($schedule->type == rectype_findweekly) echo ' CHECKED' ?> />
     79                    <label for="rectype_findweekly"><?php echo t('rectype-long: findweekly') ?></label></li>
    7480                <li><input type="radio" class="radio" name="record" value="<?php echo rectype_findone ?>" id="rectype_findone"<?php
    7581                        if ($schedule->type == rectype_findone) echo ' CHECKED' ?> />
    7682                    <label for="rectype_findone"><?php echo t('rectype-long: findone') ?></label></li>
     
    125131
    126132        </div>
    127133
     134        <div id="find_date_options">
     135            <h3><?php echo t('Find Date & Time Options') ?>:</h3>
     136            <dl class="clearfix">
     137               <dt><?php echo t('Find Day') ?>:</dt>
     138               <dd>
     139                  <select name="findday">
     140                     <option value="1"<?php
     141                        if($schedule->findday == 1)
     142                           echo ' SELECTED';?>>
     143                        <?php echo t('Sunday'); ?>
     144                     </option>
     145                     <option value="2"<?php
     146                        if($schedule->findday == 2)
     147                           echo ' SELECTED';?>>
     148                        <?php echo t('Monday'); ?>
     149                     </option>
     150                     <option value="3"<?php
     151                        if($schedule->findday == 3)
     152                           echo ' SELECTED';?>>
     153                        <?php echo t('Tuesday'); ?>
     154                     </option>
     155                     <option value="4"<?php
     156                        if($schedule->findday == 4)
     157                           echo ' SELECTED';?>>
     158                        <?php echo t('Wednesday'); ?>
     159                     </option>
     160                     <option value="5"<?php
     161                        if($schedule->findday == 5)
     162                           echo ' SELECTED';?>>
     163                        <?php echo t('Thursday'); ?>
     164                     </option>
     165                     <option value="6"<?php
     166                        if($schedule->findday == 6)
     167                           echo ' SELECTED';?>>
     168                        <?php echo t('Friday'); ?>
     169                     </option>
     170                     <option value="7"<?php
     171                        if($schedule->findday == 7)
     172                           echo ' SELECTED';?>>
     173                        <?php echo t('Saturday'); ?>
     174                     </option>
     175                  </select>
     176               </dd>
     177               <dt><?php echo t('Find Time') ?>:</dt>
     178               <dd><input type="text" name="findtime" value="<?php echo htmlentities($schedule->findtime) ?>" /></dd>
     179            </dl>
     180        </div>
     181                     
    128182        <div id="advanced_options">
    129183            <h3><?php echo t('Advanced Options') ?>:</h3>
    130184
  • skins/default/tv_schedules_custom.css

     
    4040    width:     24em !important;
    4141}
    4242
     43#find_date_options {
     44    margin: 0px auto;
     45}
     46#find_date_options dl
     47{
     48    margin: 5px 10px;
     49}
     50#find_date_options dl dt {
     51    clear:         left;
     52    float:         left;
     53    width:         13em;
     54    margin-bottom: 0.25em;
     55    text-align:    right;
     56    white-space:   nowrap;
     57}
     58#find_date_options dl dd {
     59    margin-bottom: 0.25em;
     60    margin-left:   13.5em;
     61}
     62#find_date_options select {
     63    width: 14em;
     64}
     65#find_date_options input {
     66    width: 13.7em;
     67}
     68
    4369#recording_options {
    4470    margin: 0px auto;
    4571}
  • languages/English.php

     
    187187    'Showing all programs from the $1 group.' => '',
    188188    'Showing all programs.'                   => '',
    189189// modules/tv/schedules_custom.php
    190     'Any Category'     => '',
    191     'Any Channel'      => '',
    192     'Any Program Type' => '',
     190    'Any Category'             => '',
     191    'Any Channel'              => '',
     192    'Any Program Type'         => '',
     193    'Find Date & Time Options' => 'Find Date &amp; Time Options',
     194    'Find Day'                 => '',
     195    'Find Time'                => '',
    193196// modules/tv/search.php
    194197    'Please search for something.' => '',
    195198// modules/video/init.php
  • includes/recording_schedules.php

     
    216216    // Make sure that recordid is null if it's empty
    217217        if (empty($this->recordid)) {
    218218            $this->recordid = NULL;
    219             $this->findday = (date("w", $this->starttime) + 1) % 7;
    220             $this->findtime = date("G:i:s", $this->starttime);
     219            // Only auto-default these properties if we're not dealing with a
     220            // search-based recording rule, otherwise take the values we
     221            // received from the custom schedule input form
     222            if(!$this->search) {
     223                $this->findday = (date("w", $this->starttime) + 1) % 7;
     224                $this->findtime = date("G:i:s", $this->starttime);
     225            }
    221226            $this->findid = (date("U", $this->starttime)/60/60/24) + 719528;
    222227        }
    223228    // Changing the type of recording
  • modules/tv/schedules_custom.php

     
    4949    // Which type of recording is this?  Make sure an illegal one isn't specified
    5050        switch ($_POST['record']) {
    5151        // Only certain rectypes are allowed
    52             case rectype_once:
     52            case rectype_findone:
    5353            case rectype_always:
     54            case rectype_finddaily:
     55            case rectype_findweekly:
    5456                break;
    5557        // Everything else gets ignored
    5658            default:
     
    9496            $schedule->endtime       = time() + 1;
    9597            $schedule->category      = 'Custom recording';
    9698            $schedule->search        = $_POST['searchtype'];
    97             $schedule->findday       = date('w',     $schedule->starttime);
    98             $schedule->findtime      = date('H:m:s', $schedule->starttime);
     99            $schedule->findday       = $_POST['findday'];
     100            $schedule->findtime      = strlen($_POST['findtime']) && preg_match('/^\d{1,2}:\d{2}:\d{2}$/', $_POST['findtime']) ? $_POST['findtime'] : date('H:m:s', $schedule->starttime);
    99101            $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
    100102            $schedule->transcoder    = $_POST['transcoder'];
    101103        // Build the special description