From 128b4ab08b69fdbb57023e3f664713906aa801d1 Mon Sep 17 00:00:00 2001 From: Rik Dunphy Date: Mon, 30 Dec 2019 14:04:20 -0700 Subject: [PATCH] added list mode everywhere --- app/includes/dvrui_search.php | 8 ++++- app/rules.php | 19 +++++++++-- app/search.php | 17 +++++++++- app/series.php | 18 ++++++++++- app/style/rules_entry_list.html | 17 ++++++++++ ...rules_entry.html => rules_entry_tile.html} | 0 app/style/rules_list.html | 11 ++++++- app/style/search.html | 10 ++++++ app/style/search_entry_list.html | 9 ++++++ ...arch_entry.html => search_entry_tile.html} | 0 app/style/series.html | 10 ++++++ app/style/series_entry_list.html | 8 +++++ ...ries_entry.html => series_entry_tile.html} | 0 app/themes/default/main.less | 32 +++++++++++++++++++ app/vars.php | 2 +- qnap/qpkg.cfg | 2 +- synology/INFO | 2 +- 17 files changed, 156 insertions(+), 9 deletions(-) create mode 100644 app/style/rules_entry_list.html rename app/style/{rules_entry.html => rules_entry_tile.html} (100%) create mode 100644 app/style/search_entry_list.html rename app/style/{search_entry.html => search_entry_tile.html} (100%) create mode 100644 app/style/series_entry_list.html rename app/style/{series_entry.html => series_entry_tile.html} (100%) diff --git a/app/includes/dvrui_search.php b/app/includes/dvrui_search.php index 95da8ca..f46d4ee 100644 --- a/app/includes/dvrui_search.php +++ b/app/includes/dvrui_search.php @@ -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){ @@ -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]; diff --git a/app/rules.php b/app/rules.php index 4c05ea9..a3d6a53 100644 --- a/app/rules.php +++ b/app/rules.php @@ -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 @@ -105,6 +114,7 @@ function createRule($seriesid, $recentonly, $start, $end, $channel, $recordtime, } function getRecordingRules($seriesid) { + $viewmode = getRulesViewMode(); $rulesStr = ''; // Discover Recording Rules @@ -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('',$hdhrRules->getRuleRecID($i) ,$rulesEntry); if (URLExists($hdhrRules->getRuleImage($i))) { $rulesEntry = str_replace('',$hdhrRules->getRuleImage($i),$rulesEntry); @@ -133,7 +148,7 @@ function getRecordingRules($seriesid) { $rulesEntry = str_replace('',$i-2,$rulesEntry); $rulesEntry = str_replace('',$i+1,$rulesEntry); $rulesEntry = str_replace('',$hdhrRules->getRuleTitle($i),$rulesEntry); -// $rulesEntry = str_replace('',$hdhrRules->getRuleSynopsis($i),$rulesEntry); + $rulesEntry = str_replace('',$hdhrRules->getRuleSynopsis($i),$rulesEntry); $rulesEntry = str_replace('',$hdhrRules->getRuleStartPad($i),$rulesEntry); $rulesEntry = str_replace('',$hdhrRules->getRuleEndPad($i),$rulesEntry); $rulesEntry = str_replace('',$hdhrRules->getRuleChannels($i),$rulesEntry); diff --git a/app/search.php b/app/search.php index a9b2dc4..8ad82b1 100644 --- a/app/search.php +++ b/app/search.php @@ -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 @@ -83,6 +92,7 @@ function createRuleFromSearch($searchString, $seriesid, $recentonly, $start, $en } function getSearchResults($searchString) { + $viewmode = getSearchViewMode(); $searchStr = ''; $hdhr = new DVRUI_HDHRjson(); $hdhrSearchResults = new DVRUI_Search($hdhr, $searchString); @@ -90,7 +100,12 @@ function getSearchResults($searchString) { $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('',$hdhrSearchResults->getSearchResultSeriesID($i),$searchEntry); $searchEntry = str_replace('',$hdhrSearchResults->getSearchResultImage($i),$searchEntry); $searchEntry = str_replace('',$hdhrSearchResults->getSearchResultTitle($i),$searchEntry); diff --git a/app/series.php b/app/series.php index 36ab535..1636f31 100644 --- a/app/series.php +++ b/app/series.php @@ -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(); @@ -34,6 +43,7 @@ function openSeriesPage() { function processSeriesData($hdhr, $hdhrRules, $hdhrSeries, $hdhrRecordings, $numSeries) { + $viewmode = getSeriesViewMode(); $seriesData = ''; for ($i=0; $i < $numSeries; $i++) { @@ -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('',$hdhrSeries->getSeriesID($i),$seriesEntry); $seriesEntry = str_replace('',$hdhrSeries->getRecordingImage($i),$seriesEntry); $seriesEntry = str_replace('',$hdhrSeries->getTitle($i),$seriesEntry); diff --git a/app/style/rules_entry_list.html b/app/style/rules_entry_list.html new file mode 100644 index 0000000..b191d91 --- /dev/null +++ b/app/style/rules_entry_list.html @@ -0,0 +1,17 @@ +
+ +

+

+

Priority: Start: End:

+

Channel:

+

Schedule:

+ + Recordings: + + +

+ + + +

+
diff --git a/app/style/rules_entry.html b/app/style/rules_entry_tile.html similarity index 100% rename from app/style/rules_entry.html rename to app/style/rules_entry_tile.html diff --git a/app/style/rules_list.html b/app/style/rules_list.html index 54eb1f5..eea0a81 100644 --- a/app/style/rules_list.html +++ b/app/style/rules_list.html @@ -1,5 +1,14 @@
-
+
+ +
+ +
+
diff --git a/app/style/search.html b/app/style/search.html index b008988..fe7fae4 100644 --- a/app/style/search.html +++ b/app/style/search.html @@ -1,3 +1,13 @@ +
+
+
+ +
+
Enter search criteria:
diff --git a/app/style/search_entry_list.html b/app/style/search_entry_list.html new file mode 100644 index 0000000..ce9dc5f --- /dev/null +++ b/app/style/search_entry_list.html @@ -0,0 +1,9 @@ +
+ +

+

+

Original Air Date:

+

Channel:

+ + +
diff --git a/app/style/search_entry.html b/app/style/search_entry_tile.html similarity index 100% rename from app/style/search_entry.html rename to app/style/search_entry_tile.html diff --git a/app/style/series.html b/app/style/series.html index 6a46675..c339f79 100644 --- a/app/style/series.html +++ b/app/style/series.html @@ -1,3 +1,13 @@
+
+
+
+ +
+
diff --git a/app/style/series_entry_list.html b/app/style/series_entry_list.html new file mode 100644 index 0000000..ae49b22 --- /dev/null +++ b/app/style/series_entry_list.html @@ -0,0 +1,8 @@ +
+ +

+ + + +

+
diff --git a/app/style/series_entry.html b/app/style/series_entry_tile.html similarity index 100% rename from app/style/series_entry.html rename to app/style/series_entry_tile.html diff --git a/app/themes/default/main.less b/app/themes/default/main.less index 03d2bba..98325c3 100644 --- a/app/themes/default/main.less +++ b/app/themes/default/main.less @@ -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; @@ -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 { @@ -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 { diff --git a/app/vars.php b/app/vars.php index 2682cd8..2792885 100644 --- a/app/vars.php +++ b/app/vars.php @@ -1,7 +1,7 @@