Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

Commit

Permalink
added list mode everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
demonrik committed Dec 30, 2019
1 parent 5d7d5fa commit 128b4ab
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 9 deletions.
8 changes: 7 additions & 1 deletion app/includes/dvrui_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ public function DVRUI_Search($hdhr, $searchStr) {
$this->auth = $auth;

$search_info = getJsonFromUrl($this->searchURL . $auth . "&Search=" . $searchString);

if (is_null($search_info)) {
// no data to process - leave..
return;
}

// when a series has more than one rule, then the search result repeats
// seems like a SD bug, this is the work around
if(count($search_info) > 0){
Expand All @@ -53,6 +57,8 @@ public function DVRUI_Search($hdhr, $searchStr) {
}
if (array_key_exists($this->search_Synopsis,$search_info[$i])){
$synopsis = $search_info[$i][$this->search_Synopsis];
} else {
$synopsis = 'No Synopsis';
}
if (array_key_exists($this->search_ChannelNumber,$search_info[$i])) {
$channelNumber = $search_info[$i][$this->search_ChannelNumber];
Expand Down
19 changes: 17 additions & 2 deletions app/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
require_once("includes/dvrui_rules.php");
require_once("includes/dvrui_recordings.php");
require_once("includes/dvrui_upcoming.php");

function getRulesViewMode(){
if(isset($_COOKIE['ruleViewMode'])){
$viewmode = $_COOKIE['ruleViewMode'];
}else{
$viewmode = "tile";
}
return $viewmode;
}

function openRulesPage($seriesid) {
// prep
Expand Down Expand Up @@ -105,6 +114,7 @@ function createRule($seriesid, $recentonly, $start, $end, $channel, $recordtime,
}

function getRecordingRules($seriesid) {
$viewmode = getRulesViewMode();
$rulesStr = '';

// Discover Recording Rules
Expand All @@ -121,7 +131,12 @@ function getRecordingRules($seriesid) {
$rulesData = '';
for ($i=0; $i < $numRules; $i++) {
$reccount = $hdhrRecordings->getRecordingCountBySeries($hdhrRules->getRuleSeriesID($i));
$rulesEntry = file_get_contents('style/rules_entry.html');
if (strcasecmp($viewmode,"list")==0) {
$rulesEntry = file_get_contents('style/rules_entry_list.html');
} else {
$rulesEntry = file_get_contents('style/rules_entry_tile.html');
}

$rulesEntry = str_replace('<!-- dvr_rules_id -->',$hdhrRules->getRuleRecID($i) ,$rulesEntry);
if (URLExists($hdhrRules->getRuleImage($i))) {
$rulesEntry = str_replace('<!-- dvr_rules_image -->',$hdhrRules->getRuleImage($i),$rulesEntry);
Expand All @@ -133,7 +148,7 @@ function getRecordingRules($seriesid) {
$rulesEntry = str_replace('<!-- dvr_rules_priorityPlus -->',$i-2,$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_rules_priorityMinus -->',$i+1,$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_rules_title -->',$hdhrRules->getRuleTitle($i),$rulesEntry);
// $rulesEntry = str_replace('<!-- dvr_rules_synopsis -->',$hdhrRules->getRuleSynopsis($i),$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_rules_synopsis -->',$hdhrRules->getRuleSynopsis($i),$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_rules_startpad -->',$hdhrRules->getRuleStartPad($i),$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_rules_endpad -->',$hdhrRules->getRuleEndPad($i),$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_rules_channels -->',$hdhrRules->getRuleChannels($i),$rulesEntry);
Expand Down
17 changes: 16 additions & 1 deletion app/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
require_once("includes/dvrui_search.php");
require_once("includes/dvrui_rules.php");
require_once("includes/dvrui_upcoming.php");

function getSearchViewMode(){
if(isset($_COOKIE['searchViewMode'])){
$viewmode = $_COOKIE['searchViewMode'];
}else{
$viewmode = "tile";
}
return $viewmode;
}

function openSearchPage($searchString) {
// prep
Expand Down Expand Up @@ -83,14 +92,20 @@ function createRuleFromSearch($searchString, $seriesid, $recentonly, $start, $en
}

function getSearchResults($searchString) {
$viewmode = getSearchViewMode();
$searchStr = '';
$hdhr = new DVRUI_HDHRjson();
$hdhrSearchResults = new DVRUI_Search($hdhr, $searchString);
$numResults = $hdhrSearchResults->getSearchResultCount();
$searchData = '';

for ($i=0; $i < $numResults; $i++) {
$searchEntry = file_get_contents('style/search_entry.html');
if (strcasecmp($viewmode,"list")==0) {
$searchEntry = file_get_contents('style/search_entry_list.html');
} else {
$searchEntry = file_get_contents('style/search_entry_tile.html');
}

$searchEntry = str_replace('<!-- dvr_search_seriesid -->',$hdhrSearchResults->getSearchResultSeriesID($i),$searchEntry);
$searchEntry = str_replace('<!-- dvr_search_image -->',$hdhrSearchResults->getSearchResultImage($i),$searchEntry);
$searchEntry = str_replace('<!-- dvr_search_title -->',$hdhrSearchResults->getSearchResultTitle($i),$searchEntry);
Expand Down
18 changes: 17 additions & 1 deletion app/series.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
require_once("includes/dvrui_rules.php");
require_once("includes/dvrui_upcoming.php");

function getSeriesViewMode(){
if(isset($_COOKIE['serViewMode'])){
$viewmode = $_COOKIE['serViewMode'];
}else{
$viewmode = "tile";
}
return $viewmode;
}

function openSeriesPage() {
// prep
ob_start();
Expand Down Expand Up @@ -34,6 +43,7 @@ function openSeriesPage() {


function processSeriesData($hdhr, $hdhrRules, $hdhrSeries, $hdhrRecordings, $numSeries) {
$viewmode = getSeriesViewMode();
$seriesData = '';

for ($i=0; $i < $numSeries; $i++) {
Expand Down Expand Up @@ -66,7 +76,13 @@ function processSeriesData($hdhr, $hdhrRules, $hdhrSeries, $hdhrRecordings, $num
}else{
$rulecount = $rulecount . " rules";
}
$seriesEntry = file_get_contents('style/series_entry.html');

if (strcasecmp($viewmode,"list")==0) {
$seriesEntry = file_get_contents('style/series_entry_list.html');
} else {
$seriesEntry = file_get_contents('style/series_entry_tile.html');
}

$seriesEntry = str_replace('<!-- dvr_series_id -->',$hdhrSeries->getSeriesID($i),$seriesEntry);
$seriesEntry = str_replace('<!-- dvr_recordings_image -->',$hdhrSeries->getRecordingImage($i),$seriesEntry);
$seriesEntry = str_replace('<!-- dvr_recordings_title -->',$hdhrSeries->getTitle($i),$seriesEntry);
Expand Down
17 changes: 17 additions & 0 deletions app/style/rules_entry_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div id='<!-- dvr_rules_id -->' class='rule_entry_list'>
<img src='<!-- dvr_rules_image -->' class='series_img_list'/>
<span class='rule_info'><h4><!-- dvr_rules_title --></h4></span>
<p><!-- dvr_rules_synopsis --></p>
<p>Priority: <!-- dvr_rules_priority --> Start: <!-- dvr_rules_startpad --> End: <!-- dvr_rules_endpad --></p>
<p>Channel: <!-- dvr_rules_channels --></p>
<p>Schedule: <!-- dvr_rules_recent --> <!-- dvr_rules_airdate --> <!-- dvr_rules_datetime --></p>
<span class='rule_hints'>
<span class='rule_recording_count'>Recordings: <!-- dvr_reccount --></span>
<a onClick="viewUpcomingFromRule('<!-- dvr_series_id -->');" class="upcoming"><!-- dvr_series_upcoming --></a>
</span>
<p class="actions">
<a onClick="changeRulePriority('<!-- dvr_rules_id -->', <!-- dvr_rules_priorityMinus -->);" class="play"><img src="images/down.png" height=16></a>
<a onClick="changeRulePriority('<!-- dvr_rules_id -->', <!-- dvr_rules_priorityPlus -->);" class="play"><img src="images/up.png" height=16></a>
<a onClick="RuleDeleteReveal(event,'<!-- dvr_rules_id -->');" class="delete"><img src="images/delete.png" height=16></a>
</p>
</div>
File renamed without changes.
11 changes: 10 additions & 1 deletion app/style/rules_list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<div id='rules_info'>
<div id='listheader'><!-- dvr_rules_count --></div>
<div id='listheader'>
<!-- dvr_rules_count -->
<div id="PageModifiers">
<ul class="viewmode">
<li>View As:</li>
<li><a href="JavaScript:viewRules('tile');">Tile</a></li>
<li><a href="JavaScript:viewRules('list');">List</a></li>
</ul>
</div>
</div>
<div id='rules_list_box'>
<!-- dvr_rules_list -->
</div>
Expand Down
10 changes: 10 additions & 0 deletions app/style/search.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<div id='listheader'>
<br/>
<div id="PageModifiers">
<ul class="viewmode">
<li>View As:</li>
<li><a href="JavaScript:viewSearch('tile');">Tile</a></li>
<li><a href="JavaScript:viewSearch('list');">List</a></li>
</ul>
</div>
</div>
<div id='searchheader'>
Enter search criteria: <input type='search' name='searchString' id='searchString' onSearch="goSearch()"/><button onClick="goSearch()">Search</button>
</div>
Expand Down
9 changes: 9 additions & 0 deletions app/style/search_entry_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div id='s<!-- dvr_search_seriesid -->' class='search_entry_list'>
<img src='<!-- dvr_search_image -->' class='series_img_list'/>
<span class='search_info'><h4><!-- dvr_search_title --></h4></span>
<p><!-- dvr_search_synopsis --></p>
<p>Original Air Date: <!-- dvr_search_originalAirDate --></p>
<p>Channel: <!-- dvr_search_channelNumber --> <!-- dvr_search_channelName --></p>
<!-- dvr_series_rule_list -->
<!-- dvr_series_action_links -->
</div>
File renamed without changes.
10 changes: 10 additions & 0 deletions app/style/series.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<div id="series_content">
<div id='listheader'>
<br/>
<div id="PageModifiers">
<ul class="viewmode">
<li>View As:</li>
<li><a href="JavaScript:viewSeries('tile');">Tile</a></li>
<li><a href="JavaScript:viewSeries('list');">List</a></li>
</ul>
</div>
</div>
<div id='series_box'><!-- dvrui_recordings_data --></div>
</div>
8 changes: 8 additions & 0 deletions app/style/series_entry_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div id='<!-- dvr_recordings_title -->' class='series_entry_list'>
<img src='<!-- dvr_recordings_image -->' class='series_img_lrg_list'/>
<p class="actions">
<a onClick="selectRule('<!-- dvr_series_id -->');" class='RuleCountButton'><!-- dvr_rules_count --></a>
<a onClick="selectSeries('<!-- dvr_series_id -->');" class='RecCountButton'><!-- dvr_recordings_count --></a>
<a onClick="selectUpcoming('<!-- dvr_series_id -->');" class='UpcomingCountButton'><!-- dvr_upcoming_count --></a>
</p>
</div>
File renamed without changes.
32 changes: 32 additions & 0 deletions app/themes/default/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,17 @@ a.settings_page{
.entry-p;
}

.rule_entry_list {
.entry_list;
}
.rule_entry_list h4 {
.entry_list-h4;
}
.rule_entry_list p {
.entry_list-p;
}


.rule_hints {
width: 100%;
color: @EntryTextColor;
Expand Down Expand Up @@ -467,6 +478,17 @@ a.settings_page{
display:inline-block;
}

.series_entry_list {
width: 100%px;
height: 225px;
border: solid 1px @EntryBorderColor;
background: @EntryBackgroundColor;
box-shadow: 5px 5px 5px #000;
margin: 5px;
position: relative;
}


/* Recordings Tab ----------------------------------------------------------------- */

#recordings_page {
Expand Down Expand Up @@ -582,6 +604,16 @@ ul.viewmode li a{
.entry-p;
}

.search_entry_list {
.entry_list;
}
.search_entry_list h4 {
.entry_list-h4;
}
.search_entry_list p {
.entry_list-p;
}

/* Advanced Rule Modal Dialog ------------------------------------------------------*/

.edit_form ul {
Expand Down
2 changes: 1 addition & 1 deletion app/vars.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
final class DVRUI_Vars
{
const DVRUI_version ="0.8.5";
const DVRUI_version ="0.8.6";
const DVRUI_name ="HDHomeRun DVR UI";
const DVRUI_git ="https://github.com/demonrik/HDHR-DVRUI.git";
const DVRUI_apiurl ="http://api.hdhomerun.com/";
Expand Down
2 changes: 1 addition & 1 deletion qnap/qpkg.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Name of the packaged application.
QPKG_NAME="HDHR-DVRUI"
# Version of the packaged application.
QPKG_VER="0.8.0"
QPKG_VER="0.8.6"
# Author or maintainer of the package
QPKG_AUTHOR="Rik Dunphy"
# License for the packaged application
Expand Down
2 changes: 1 addition & 1 deletion synology/INFO
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package="HDHR-DVRUI"
version="0.7.0"
version="0.8.6"
maintainer="[email protected]"
arch="noarch"
startable="no"
Expand Down

0 comments on commit 128b4ab

Please sign in to comment.