浏览代码

Added Calendar Filtering

causefx 7 年之前
父节点
当前提交
b0107288ee
共有 4 个文件被更改,包括 55 次插入5 次删除
  1. 9 0
      api/functions/homepage-connect-functions.php
  2. 40 5
      api/pages/homepage.php
  3. 6 0
      js/custom.js
  4. 0 0
      js/custom.min.js

+ 9 - 0
api/functions/homepage-connect-functions.php

@@ -1084,6 +1084,7 @@ function getSonarrCalendar($array, $number)
 			"start" => $child['airDateUtc'],
 			"className" => "bg-calendar calendar-item tvID--" . $episodeID,
 			"imagetype" => "tv " . $downloaded,
+			"imagetypeFilter" => "tv",
 			"details" => $details
 		));
 	}
@@ -1145,6 +1146,7 @@ function getLidarrCalendar($array, $number)
 			"start" => $child['releaseDate'],
 			"className" => "bg-calendar calendar-item musicID--",
 			"imagetype" => "music " . $downloaded,
+			"imagetypeFilter" => "music",
 			"details" => $details
 		));
 	}
@@ -1234,6 +1236,7 @@ function getRadarrCalendar($array, $number, $url)
 				"start" => $physicalRelease,
 				"className" => "bg-calendar movieID--" . $movieID,
 				"imagetype" => "film " . $downloaded,
+				"imagetypeFilter" => "film",
 				"details" => $details
 			));
 		}
@@ -1314,6 +1317,7 @@ function getCouchCalendar($array, $number)
 				"start" => $physicalRelease,
 				"className" => "bg-calendar calendar-item movieID--" . $movieID,
 				"imagetype" => "film " . $downloaded,
+				"imagetypeFilter" => "film",
 				"details" => $details
 			));
 		}
@@ -1380,6 +1384,7 @@ function getSickrageCalendarWanted($array, $number)
 			"start" => $episodeAirDate,
 			"className" => "bg-calendar calendar-item tvID--" . $episodeID,
 			"imagetype" => "tv " . $downloaded,
+			"imagetypeFilter" => "tv",
 			"details" => $details,
 		));
 	}
@@ -1434,6 +1439,7 @@ function getSickrageCalendarWanted($array, $number)
 			"start" => $episodeAirDate,
 			"className" => "bg-calendar calendar-item tvID--" . $episodeID,
 			"imagetype" => "tv " . $downloaded,
+			"imagetypeFilter" => "tv",
 			"details" => $details,
 		));
 	}
@@ -1488,6 +1494,7 @@ function getSickrageCalendarWanted($array, $number)
 			"start" => $episodeAirDate,
 			"className" => "bg-calendar calendar-item tvID--" . $episodeID,
 			"imagetype" => "tv " . $downloaded,
+			"imagetypeFilter" => "tv",
 			"details" => $details,
 		));
 	}
@@ -1542,6 +1549,7 @@ function getSickrageCalendarWanted($array, $number)
 			"start" => $episodeAirDate,
 			"className" => "bg-calendar calendar-item tvID--" . $episodeID,
 			"imagetype" => "tv " . $downloaded,
+			"imagetypeFilter" => "tv",
 			"details" => $details,
 		));
 	}
@@ -1593,6 +1601,7 @@ function getSickrageCalendarHistory($array, $number)
 			"start" => $episodeAirDate,
 			"className" => "bg-calendar calendar-item tvID--" . $episodeID,
 			"imagetype" => "tv " . $downloaded,
+			"imagetypeFilter" => "tv",
 			"details" => $details,
 		));
 	}

+ 40 - 5
api/pages/homepage.php

@@ -26,6 +26,14 @@ if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
 
         var $this = this;
         $this.$calendarObj = $this.$calendar.fullCalendar({
+        	customButtons: {
+			    filterCalendar: {
+			      text: \'Filter\',
+			      click: function() {
+			        $(\'#calendar-filter-modal\').modal(\'show\');
+			      }
+			    }
+			  },
             defaultView: (activeInfo.mobile) ? "list" : "' . $GLOBALS['calendarDefault'] . '",
             firstDay: "' . $GLOBALS['calendarFirstDay'] . '",
             timeFormat: "' . $GLOBALS['calendarTimeFormat'] . '",
@@ -33,7 +41,7 @@ if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
             header: {
                left: "prev,next,today",
                center: "title",
-               right: (activeInfo.mobile) ? "" : "month,basicWeek,basicDay,list",
+               right: (activeInfo.mobile) ? "filterCalendar" : "filterCalendar,month,basicWeek,basicDay,list",
             },
             views: {
                basicDay: { buttonText: window.lang.translate("Day"), eventLimit: ' . $GLOBALS['calendarLimit'] . ' },
@@ -50,15 +58,15 @@ if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
             eventRender: function eventRender( event, element, view ) {
                 if (typeof filter !== "undefined") {
                     if(filter === "all"){
-                        return event.imagetype === event.imagetype;
+                        return event.imagetypeFilter === event.imagetypeFilter;
                     }else if(filter !== "all"){
-                        return filter === event.imagetype;
+                        return filter === event.imagetypeFilter;
                     }
                     if(filter === null){
-                        return event.imagetype === event.imagetype;
+                        return event.imagetypeFilter === event.imagetypeFilter;
                     }
                 }else {
-                    return event.imagetype === event.imagetype;
+                    return event.imagetypeFilter === event.imagetypeFilter;
                 }
             },
         });
@@ -79,5 +87,32 @@ function($) {
     <div class="col-md-8 col-md-offset-2 youtube-div">  </div>
 </div>
 <!-- /.container-fluid -->
+<!--  modal content -->
+<div id="calendar-filter-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" style="display: none;">
+    <div class="modal-dialog modal-sm">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+                <h4 class="modal-title" id="mySmallModalLabel" lane="en">Filter Calendar</h4> </div>
+            <div class="modal-body">
+            	<div class="row">
+                    
+                    <div class="col-md-12">
+                        <label class="control-label" lang="en">Choose Media Type</label>
+                        <select class="form-control form-white" data-placeholder="Choose media type" id="choose-calender-filter">
+                            <option value="all">All</option>
+                            <option value="tv">TV</option>
+                            <option value="film">Movie</option>
+                            <option value="music">Music</option>
+                        </select>
+                    </div>
+                </div>
+			</div>
+        </div>
+        <!-- /.modal-content -->
+    </div>
+    <!-- /.modal-dialog -->
+</div>
+<!-- /.modal -->
 ';
 }

+ 6 - 0
js/custom.js

@@ -1738,3 +1738,9 @@ $(document).on('change', "#edit-tab-form-chooseIcon", function (e) {
         $('#edit-tab-form-inputImage').val(newIcon);
     }
 });
+$(document).on('change', "#choose-calender-filter", function (e) {
+    filter = $('#choose-calender-filter').val();
+    $('#calendar-filter-modal').modal('hide');
+    console.log("Calendar Filter: "+filter);
+    $('#calendar').fullCalendar('rerenderEvents');
+});

文件差异内容过多而无法显示
+ 0 - 0
js/custom.min.js


部分文件因为文件数量过多而无法显示