fixes #97 and creates a library dictionary cache to avoid FindById recursion

This commit is contained in:
Luke Pulverenti 2013-03-31 13:39:28 -04:00
parent 991cbb0830
commit 3eb34de649
6 changed files with 30 additions and 61 deletions

View File

@ -6,7 +6,7 @@
<body>
<div id="indexPage" data-role="page" class="page type-home libraryPage" data-theme="a">
<div data-role="content">
<h1>What's New <a href="itemlist.html?IsRecentlyAdded=true&Recursive=true&Title=Recently Added Items" class="imageLink">
<h1>What's New <a href="itemlist.html?SortBy=DateCreated&SortOrder=Descending&Recursive=true&Title=Recently Added" class="imageLink">
<img src="css/images/rightarrow.png" /></a></h1>
<div id="divWhatsNew"></div>
@ -18,13 +18,7 @@
<div id="divResumableItems"></div>
</div>
<h1>My Library <a href="itemlist.html" class="imageLink">
<img src="css/images/rightarrow.png" /></a></h1>
<div id="divMyLibrary"></div>
<h1>Collections <a href="itemlist.html" class="imageLink">
<img src="css/images/rightarrow.png" /></a></h1>
<h1>Collections</h1>
<div id="divCollections"></div>
</div>

View File

@ -24,6 +24,8 @@
<div class="itemDetailBlock">
<p id="itemRatings" style="text-align: right;">
</p>
<p id="itemTagline" style="font-style: italic;"></p>
<p id="itemOverview"></p>
<p id="itemCommunityRating"></p>
@ -35,8 +37,6 @@
<p id="itemStudios">
</p>
<p id="itemRatings">
</p>
</div>
</div>

View File

@ -34,28 +34,28 @@
<h3>Sort By:</h3>
</legend>
<input data-theme="c" type="radio" name="radioSortBy" id="radioName" value="on" checked="checked">
<label for="radioName" onclick="ItemListPage.sortBy('SortName');">Name</label>
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioSortName" value="on" checked="checked">
<label for="radioSortName" onclick="ItemListPage.sortBy('SortName');">Name</label>
<input data-theme="c" type="radio" name="radioSortBy" id="radioCommunityRating" value="other">
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioCommunityRating" value="other">
<label for="radioCommunityRating" onclick="ItemListPage.sortBy('CommunityRating');">Community Rating</label>
<input data-theme="c" type="radio" name="radioSortBy" id="radioDateAdded" value="other">
<label for="radioDateAdded" onclick="ItemListPage.sortBy('DateCreated');">Date Added</label>
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioDateCreated" value="other">
<label for="radioDateCreated" onclick="ItemListPage.sortBy('DateCreated');">Date Added</label>
<input data-theme="c" type="radio" name="radioSortBy" id="radioDatePlayed" value="other">
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioDatePlayed" value="other">
<label for="radioDatePlayed" onclick="ItemListPage.sortBy('DatePlayed');">Date Played</label>
<input data-theme="c" type="radio" name="radioSortBy" id="radioPremiereDate" value="other">
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioPremiereDate" value="other">
<label for="radioPremiereDate" onclick="ItemListPage.sortBy('PremiereDate');">Date Released</label>
<input data-theme="c" type="radio" name="radioSortBy" id="radioPlayCount" value="off">
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioPlayCount" value="off">
<label for="radioPlayCount" onclick="ItemListPage.sortBy('PlayCount');">Play Count</label>
<input data-theme="c" type="radio" name="radioSortBy" id="radioRandom" value="off">
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioRandom" value="off">
<label for="radioRandom" onclick="ItemListPage.sortBy('Random');">Random</label>
<input data-theme="c" type="radio" name="radioSortBy" id="radioRuntime" value="off">
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioRuntime" value="off">
<label for="radioRuntime" onclick="ItemListPage.sortBy('Runtime');">Runtime</label>
</fieldset>
@ -64,10 +64,10 @@
<h3>Sort Order:</h3>
</legend>
<input data-theme="c" type="radio" name="radioSortOrder" id="radioAscending" value="on" checked="checked">
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioAscending" value="on" checked="checked">
<label for="radioAscending" onclick="ItemListPage.sortOrder('Ascending');">Ascending</label>
<input data-theme="c" type="radio" name="radioSortOrder" id="radioDescending" value="other">
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioDescending" value="other">
<label for="radioDescending" onclick="ItemListPage.sortOrder('Descending');">Descending</label>
</fieldset>
</div>
@ -92,9 +92,6 @@
<input type="checkbox" name="chkDislikes" id="chkDislikes" onchange="ItemListPage.filter('Dislikes', this.checked);" data-theme="c">
<label for="chkDislikes">Dislikes</label>
<input type="checkbox" name="chkRecentlyAdded" id="chkRecentlyAdded" onchange="ItemListPage.filter('IsRecentlyAdded', this.checked);" data-theme="c">
<label for="chkRecentlyAdded">Recently added</label>
<input type="checkbox" name="chkResumable" id="chkResumable" onchange="ItemListPage.filter('IsResumable', this.checked);" data-theme="c">
<label for="chkResumable">Resumable</label>
</fieldset>

View File

@ -731,9 +731,9 @@
}
if (userData.IsFavorite) {
html += '<img class="imgUserItemRating" src="css/images/userdata/heart_on.png" alt="Favorite" title="Remove favorite" onclick="ItemDetailPage.setFavorite();" />';
html += '<img class="imgUserItemRating" src="css/images/userdata/heart_on.png" alt="Favorite" title="Favorite" onclick="ItemDetailPage.setFavorite();" />';
} else {
html += '<img class="imgUserItemRating" src="css/images/userdata/heart_off.png" alt="Favorite" title="Mark favorite" onclick="ItemDetailPage.setFavorite();" />';
html += '<img class="imgUserItemRating" src="css/images/userdata/heart_off.png" alt="Favorite" title="Favorite" onclick="ItemDetailPage.setFavorite();" />';
}
$('#itemRatings', page).html(html);

View File

@ -70,37 +70,6 @@
}));
});
IndexPage.loadMyLibrary(userId, page);
},
loadMyLibrary: function (userId, page) {
var items = [{
Name: "Recently Played",
IsFolder: true
}, {
Name: "Favorites",
IsFolder: true,
url: "itemlist.html?IsFavorite=true&Recursive=true&Title=Favorites"
}, {
Name: "Genres",
IsFolder: true
}, {
Name: "Studios",
IsFolder: true
}, {
Name: "Performers",
IsFolder: true
}, {
Name: "Directors",
IsFolder: true
}];
$('#divMyLibrary', page).html(Dashboard.getPosterViewHtml({
items: items,
showTitle: true
}));
}
};

View File

@ -13,7 +13,6 @@
var query = {
Fields: "PrimaryImageAspectRatio",
SortBy: "SortName",
Recursive: getParameterByName('Recursive') == 'true'
};
@ -34,7 +33,19 @@
$('#chkRecentlyAdded', page).checked(true).checkboxradio("refresh");
}
var sortBy = getParameterByName('SortBy') || 'SortName';
query.SortBy = sortBy;
$('.radioSortBy', page).checked(false).checkboxradio("refresh");
$('#radio' + sortBy, page).checked(true).checkboxradio("refresh");
var order = getParameterByName('SortOrder') || 'Ascending';
query.SortOrder = order;
$('.radioSortOrder', page).checked(false).checkboxradio("refresh");
$('#radio' + order, page).checked(true).checkboxradio("refresh");
query.Filters = filters.join(',');
//query.limit = 100;
if (parentId) {
query.parentId = parentId;
@ -112,8 +123,6 @@
query.Filters = filters;
query.Recursive = filters.length ? true : false;
ItemListPage.refreshItems(query);
},