summaryrefslogtreecommitdiffstats
path: root/install/static/search.js
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-08-19 20:48:21 -0400
committerAdam Young <ayoung@redhat.com>2010-08-19 20:49:14 -0400
commit12ee9365a7a08c7a45887b98f17a44c64d7eb5f0 (patch)
tree838143295e68b8c8e334272a12e682708b427032 /install/static/search.js
parent9a160275351c5763209346466a331b06546ac0e0 (diff)
downloadfreeipa-12ee9365a7a08c7a45887b98f17a44c64d7eb5f0.tar.gz
freeipa-12ee9365a7a08c7a45887b98f17a44c64d7eb5f0.tar.xz
freeipa-12ee9365a7a08c7a45887b98f17a44c64d7eb5f0.zip
Changes the URL parsing from standard HTML params ( starting with ?)
to hash params ( starting with # ). User Details are now part of index.xhtml, ao one more .inc file has been removed. Updated commit to catch a few things that had been left out, including sampledata handling and updateing Makefile.am
Diffstat (limited to 'install/static/search.js')
-rw-r--r--install/static/search.js86
1 files changed, 40 insertions, 46 deletions
diff --git a/install/static/search.js b/install/static/search.js
index de11f2eda..fbcec7867 100644
--- a/install/static/search.js
+++ b/install/static/search.js
@@ -2,33 +2,6 @@
var sampleData;
-function clearOld(){
- $('#searchResultsTable thead').html("");
- $('#searchResultsTable tfoot').html("");
- $('#searchResultsTable tbody').find("tr").remove();
- $('#content').html("");
-}
-
-function showSearch(){
- clearOld();
- $('#search').css("visibility","visible");
- $('#content').css("visibility","hidden");
- $('#search').css("display","block");
- $('#content').css("display","none");
- $("#filter").css("display","block");
- $("#searchButtons").html("");
-
-
-}
-
-function showContent(){
- clearOld();
- $('#search').css("visibility","hidden");
- $('#content').css("visibility","visible");
- $('#search').css("display","none");
- $('#content').css("display","block");
-}
-
//Columns is an array of items in the form
// {title, column, render}
//title: the the value that goes at the head of the column
@@ -52,15 +25,16 @@ function renderUnknownColumn(current,cell){
}
function renderDetailColumn(current,cell,pkey,obj){
- link = document.createElement("a");
- link.href= "?tab=" +obj+"&facet=details&pkey="+pkey;
- link.innerHTML = pkey;
- cell.appendChild(link);
+ $("<a/>",{
+ href:"#tab=user&facet=details&pkey="+pkey,
+ html: ""+ current[this.column],
+ click: function(){ setupUserDetails(current.uid)},
+ }).appendTo(cell);
}
-function SearchForm(obj, method, cols){
+function SearchForm(obj, method, cols, searchSampleData){
this.buildColumnHeaders = function (){
var columnHeaders = document.createElement("tr");
@@ -96,35 +70,55 @@ function SearchForm(obj, method, cols){
}
}
+ this.searchWithFilter = function(queryFilter){
+ var form = this;
+ window.location.hash="#tab="
+ +this.obj
+ +"&facet=search&criteria="
+ +queryFilter;
+
+ $('#searchResultsTable tbody').html("");
+ $('#searchResultsTable tbody').html("");
+ $('#searchResultsTable tfoot').html("");
+
+ ipa_cmd(this.method,
+ [queryFilter],
+ {"all":"true"},
+ function(json){
+ form.searchSuccess(json);
+ },
+ function(json){
+ alert("Search Failed");
+ },form.obj, form.searchSampleData);
+
+ }
+
this.obj = obj;
this.method = method;
this.columns = cols;
+ this.searchSampleData = searchSampleData;
showSearch();
$('#searchResultsTable thead').html("");
$('#searchResultsTable tbody').html("");
+ $('#searchResultsTable tfoot').html("");
+
$("#new").click(function(){
- location.href="?tab="+obj+"&facet=add";
+ location.href="#tab="+obj+"&facet=add";
});
this.buildColumnHeaders();
+
+ var params = ipa_parse_qs();
+
+ if (params["criteria"]){
+ this.searchWithFilter(params["criteria"]);
+ }
}
executeSearch = function(searchForm){
var queryFilter = $("#queryFilter").val();
-
- $('#searchResultsTable tbody').html("");
-
- ipa_cmd(searchForm.method,
- [queryFilter],
- {"all":"true"},
- function(json){
- searchForm.searchSuccess(json);
- },
- function(json){
- alert("Search Failed");
- },searchForm.obj);
-
+ searchForm.searchWithFilter(queryFilter);
}