summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-07-07 22:23:02 -0400
committerAdam Young <ayoung@redhat.com>2010-07-07 22:23:02 -0400
commit7ce25ac7bf59697b6315420d337665a4e497dda6 (patch)
tree01ffce22542dcb2470dcab30cc8cd8c34696a55a
parentc3e251d892e8cc4c643a55a30b10ff417a3dd617 (diff)
downloadfreeipa-7ce25ac7bf59697b6315420d337665a4e497dda6.tar.gz
freeipa-7ce25ac7bf59697b6315420d337665a4e497dda6.tar.xz
freeipa-7ce25ac7bf59697b6315420d337665a4e497dda6.zip
Converted from html genreation in text to DOM API. Made it possible to switch to and from sample data by setting a single variable.
-rw-r--r--install/static/group.js3
-rw-r--r--install/static/search.js26
-rw-r--r--install/static/user.js61
3 files changed, 65 insertions, 25 deletions
diff --git a/install/static/group.js b/install/static/group.js
index 481be4b53..065b979b5 100644
--- a/install/static/group.js
+++ b/install/static/group.js
@@ -1,6 +1,9 @@
function setupGroupSearch(){
+
+ sampleData = "sampledata/grouplist.json";
+
function renderGroupRow(group){
var row = "<tr>"
diff --git a/install/static/search.js b/install/static/search.js
index 064f00664..f192014f4 100644
--- a/install/static/search.js
+++ b/install/static/search.js
@@ -1,4 +1,5 @@
-
+var sampleData;
+var useSampleData = false;
function SearchForm(method, cols, modAction,renderRow){
this.method = method;
@@ -7,15 +8,17 @@ function SearchForm(method, cols, modAction,renderRow){
this.renderRow = renderRow;
this.buildColumnHeaders = function (){
- var columnHeaders = "<tr>";
+ var columnHeaders = document.createElement("tr");
for (var i =0 ; i != this.columns.length ;i++){
- columnHeaders += "<th>";
- columnHeaders += this.columns[i][0];
- columnHeaders += "</th>";
+ var th = document.createElement("th");
+ th.innerHTML = this.columns[i][0];
+ columnHeaders.appendChild(th);
}
- columnHeaders += "<th>Actions</th>"
- columnHeaders += "</tr>";
- $('#searchResultsTable thead:last').append(columnHeaders);
+
+ var th = document.createElement("th");
+ th.innerHTML = "actions";
+ columnHeaders.appendChild(th);
+ $('#searchResultsTable thead:last').append(columnHeaders);
}
this.searchSuccess = function (json){
@@ -38,9 +41,10 @@ executeSearch = function(searchForm){
var requesturl = "/ipa/json";
//For development without a webserver, just fetch a static file
//change this to true
- if (false){
- //var requesturl = "sampledata/userlist.json";
- var requesturl = "sampledata/grouplist.json";
+ if (useSampleData){
+ var requesturl = sampleData
+ //"sampledata/userlist.json";
+ //var requesturl = "sampledata/grouplist.json";
}
diff --git a/install/static/user.js b/install/static/user.js
index 3d13ab219..041d2c9b3 100644
--- a/install/static/user.js
+++ b/install/static/user.js
@@ -1,22 +1,55 @@
function setupUserSearch(){
+sampleData = "sampledata/userlist.json";
+
+
function renderUsersResultRow(current){
- var row = '<tr>';
- row += '<td><a href="'+this.modifyAction+'">';
- row += current[this.columns[0][1]];
- row += '</a></td>';
+
+
+
+
+ var href= '#' ;
+ var row = document.createElement("tr");
+
+ var cell = row.insertCell(0);
+
+
+ var link = document.createElement("a");
+ link.href="#";
+ link.innerHTML = current[this.columns[0][1]];
+ link.onclick = function(){
+ alert("w00t");
+ };
+
+
+ cell.appendChild(link);
+
+
for (var i = 1; i != this.columns.length ; i++){
- row += '<td>';
- row += current[this.columns[i][1]];
- row += '</td>';
+ cell = row.insertCell(i);
+ cell.innerHTML = current[this.columns[i][1]];
}
- row += '<td>';
- row += '<a href="ipa.xhtml?bodycontent=user-edit.inc'
- //TODO Put uid in here
- row += '">[modify]</a>'
- row += ' <a href="#">[delete]</a>'
- row += '<a href="#">[clone]</a></td></tr>';
+
+
+ cell = row.insertCell(this.columns.length);
+
+ link = document.createElement("a");
+ link.href="#";
+ link.innerHTML = "[modify]"
+ cell.appendChild(link);
+
+ link = document.createElement("a");
+ link.href="#";
+ link.innerHTML = "[delete]"
+ cell.appendChild(link);
+
+ link = document.createElement("a");
+ link.href="#";
+ link.innerHTML = "[clone]"
+ cell.appendChild(link);
+
+
return row;
}
@@ -27,7 +60,7 @@ function setupUserSearch(){
["EMAIL", "mail"],
["Phone", "telephonenumber"],
["Job Title", "title"]];
- var searchForm = new SearchForm("user_find", columns,'ipa.xhtml?bodycontent=user-edit.inc', renderUsersResultRow);
+ var searchForm = new SearchForm("user_find", columns,'/ipa/edit?obj_name=user', renderUsersResultRow);
searchForm.buildColumnHeaders();