Browse Source

- Remember selected filter using a Cookie (Web UI)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
f0a18ec1f5
  1. 13
      src/webui/filters.html
  2. 2
      src/webui/scripts/client.js
  3. 5
      src/webui/scripts/dynamicTable.js

13
src/webui/filters.html

@ -1,7 +1,16 @@ @@ -1,7 +1,16 @@
<ul>
<li class="selectedFilter" id="all_filter"><a href="#" onclick="setFilter('all');"><img src="images/skin/filterall.png"/>_(All)</a></li>
<li id="all_filter"><a href="#" onclick="setFilter('all');"><img src="images/skin/filterall.png"/>_(All)</a></li>
<li id="downloading_filter"><a href="#" onclick="setFilter('downloading');"><img src="images/skin/downloading.png"/>_(Downloading)</a></li>
<li id="completed_filter"><a href="#" onclick="setFilter('completed');"><img src="images/skin/uploading.png"/>_(Completed)</a></li>
<li id="active_filter"><a href="#" onclick="setFilter('active');"><img src="images/skin/filteractive.png"/>_(Active)</a></li>
<li id="inactive_filter"><a href="#" onclick="setFilter('inactive');"><img src="images/skin/filterinactive.png"/>_(Inactive)</a></li>
</ul>
</ul>
<script type="text/javascript">
// Remember this via Cookie
var last_filter = Cookie.read('selected_filter');
if(!$defined(last_filter)) {
last_filter = 'all';
}
$(last_filter+'_filter').addClass('selectedFilter');
</script>

2
src/webui/scripts/client.js

@ -177,6 +177,8 @@ window.addEvent('domready', function(){ @@ -177,6 +177,8 @@ window.addEvent('domready', function(){
$(f+"_filter").addClass("selectedFilter");
myTable.setFilter(f);
ajaxfn();
// Remember this via Cookie
Cookie.write('selected_filter', f);
}
});

5
src/webui/scripts/dynamicTable.js

@ -42,7 +42,10 @@ var dynamicTable = new Class ({ @@ -42,7 +42,10 @@ var dynamicTable = new Class ({
this.cur = new Array();
this.priority_hidden = false;
this.progressIndex = progressIndex;
this.filter = 'all';
this.filter = Cookie.read('selected_filter');
if(!$defined(this.filter)) {
this.filter = 'all';
}
this.context_menu = context_menu;
this.table.sortedIndex = 1; // Default is NAME
this.table.reverseSort = false;

Loading…
Cancel
Save