[Freeipa-devel] [PATCH] search box in header, other fixes
Kevin McCarthy
kmccarth at redhat.com
Thu Sep 6 18:11:08 UTC 2007
This patch adds a search box into the header.
It changes the account status to use a select instead of a checkbox.
It also makes a small improvement to auto-suggest, to keep suggesting
(as you fix the name) until you overwrite the suggestion yourself.
-Kevin
-------------- next part --------------
# HG changeset patch
# User Kevin McCarthy <kmccarth at redhat.com>
# Date 1189102152 25200
# Node ID b401723077f1f3e705f983185b07c47a95eb2579
# Parent fb7131394f05647904166312bb369b77f235a70d
Add search box in header.
Change account status to use select list and 'active'/'inactive' values.
Improve autosuggest to keep suggesting unless you overwrite a suggestion
(if you correct the name, it will re-suggest).
diff -r fb7131394f05 -r b401723077f1 ipa-server/ipa-gui/ipagui/controllers.py
--- a/ipa-server/ipa-gui/ipagui/controllers.py Wed Sep 05 16:59:55 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/controllers.py Thu Sep 06 11:09:12 2007 -0700
@@ -47,6 +47,14 @@ class Root(controllers.RootController):
@expose(template="ipagui.templates.welcome")
def index(self):
return dict()
+
+ @expose()
+ def topsearch(self, **kw):
+ if kw.get('searchtype') == "Users":
+ return self.userlist(uid=kw.get('searchvalue'))
+ else:
+ return self.index()
+
########
diff -r fb7131394f05 -r b401723077f1 ipa-server/ipa-gui/ipagui/forms/user.py
--- a/ipa-server/ipa-gui/ipagui/forms/user.py Wed Sep 05 16:59:55 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/forms/user.py Thu Sep 06 11:09:12 2007 -0700
@@ -10,7 +10,10 @@ class UserFields():
sn = widgets.TextField(name="sn", label="Last name")
mail = widgets.TextField(name="mail", label="E-mail address")
telephonenumber = widgets.TextField(name="telephonenumber", label="Phone")
- nsAccountLock = widgets.CheckBox(name="nsAccountLock", label="Account Deactivated")
+ # nsAccountLock = widgets.CheckBox(name="nsAccountLock", label="Account Deactivated")
+ nsAccountLock = widgets.SingleSelectField(name="nsAccountLock",
+ label="Account Status",
+ options = [("", "active"), ("true", "inactive")])
uid.validator = validators.PlainText(not_empty=True)
userpassword.validator = validators.String(not_empty=True)
diff -r fb7131394f05 -r b401723077f1 ipa-server/ipa-gui/ipagui/helpers/userhelper.py
--- a/ipa-server/ipa-gui/ipagui/helpers/userhelper.py Wed Sep 05 16:59:55 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/helpers/userhelper.py Thu Sep 06 11:09:12 2007 -0700
@@ -21,3 +21,9 @@ def password_is_expired(days):
def password_expires_soon(days):
return (not password_is_expired(days)) and (days < 7)
+
+def account_status_display(status):
+ if status == "true":
+ return "inactive"
+ else:
+ return "active"
diff -r fb7131394f05 -r b401723077f1 ipa-server/ipa-gui/ipagui/static/css/style.css
--- a/ipa-server/ipa-gui/ipagui/static/css/style.css Wed Sep 05 16:59:55 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/static/css/style.css Thu Sep 06 11:09:12 2007 -0700
@@ -17,6 +17,7 @@ body {
background:#ccc; /* should be same as #sidebar */
margin:0 auto;
width:100%;
+ clear:both;
}
@@ -24,16 +25,25 @@ body {
background:#fff;
}
-#header h1 {
- padding:5px;
- margin:0;
+#header #logo {
+ float:left;
}
-#header #logo {
+#header #headerinfo {
+ text-align:right;
}
-#header #login {
- float:right;
+#header #headerinfo #login {
+}
+
+#header #headerinfo #topsearch {
+ padding-top: 15px;
+}
+
+.searchtext {
+ background-color:#E5F1F4;
+ border:1px solid #8E8E8E;
+ color:#444444;
}
@@ -42,7 +52,6 @@ body {
color:#fff;
min-height:3px;
max-height:3px;
- clear:both;
}
#nav ul {
diff -r fb7131394f05 -r b401723077f1 ipa-server/ipa-gui/ipagui/templates/master.kid
--- a/ipa-server/ipa-gui/ipagui/templates/master.kid Wed Sep 05 16:59:55 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/master.kid Thu Sep 06 11:09:12 2007 -0700
@@ -24,19 +24,41 @@
</span>
</div>
- <div id="page">
- <div id="header">
+ <div id="header">
+ <div id="logo">
+ <a href="${tg.url('/')}"><img
+ src="${tg.url('/static/images/logo.png')}"
+ border="0"
+ /></a>
+ </div>
+ <div id="headerinfo">
<div id="login">
Logged in as: ace
</div>
- <div id="logo">
- <a href="${tg.url('/')}"><img
- src="${tg.url('/static/images/logo.png')}"
- border="0"
- /></a>
+ <div id="topsearch">
+ <form action="${tg.url('/topsearch')}" method="post">
+ <select name="searchtype">
+ <option>Users</option>
+ <option>Groups</option>
+ </select>
+ <input class="searchtext" id="topsearchbox" type="text"
+ name="searchvalue"
+ value="Type search terms here."
+ onfocus="clearsearch()" />
+ <input type="submit" value="Search"/>
+ </form>
+ <script type="text/javascript">
+ function clearsearch() {
+ topsearchbox = document.getElementById('topsearchbox');
+ topsearchbox.onfocus = null;
+ topsearchbox.value = "";
+ }
+ </script>
</div>
</div>
+ </div>
+ <div id="page">
<div id="nav"><!--
This used to have links. Keeping around in case we move them back...
--></div>
diff -r fb7131394f05 -r b401723077f1 ipa-server/ipa-gui/ipagui/templates/usernewform.kid
--- a/ipa-server/ipa-gui/ipagui/templates/usernewform.kid Wed Sep 05 16:59:55 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/usernewform.kid Thu Sep 06 11:09:12 2007 -0700
@@ -27,6 +27,9 @@
<span py:if="tg.errors.get('sn')" class="fielderror"
py:content="tg.errors.get('sn')" />
<script type="text/javascript">
+ var uid_suggest = ""
+ var mail_suggest = ""
+
function autofill(self) {
givenname = document.getElementById('form_givenname');
sn = document.getElementById('form_sn');
@@ -35,22 +38,24 @@
}
uid = document.getElementById('form_uid');
mail = document.getElementById('form_mail');
- if (uid.value == "") {
+ if ((uid.value == "") || (uid.value == uid_suggest)) {
new Ajax.Request('${tg.url('/suggest_uid')}', {
method: 'get',
parameters: {'givenname': givenname.value, 'sn': sn.value},
onSuccess: function(transport) {
uid.value = transport.responseText;
+ uid_suggest = uid.value;
new Effect.Highlight(uid);
}
});
}
- if (mail.value == "") {
+ if ((mail.value == "") || (mail.value == mail_suggest)) {
new Ajax.Request('${tg.url('/suggest_email')}', {
method: 'get',
parameters: {'givenname': givenname.value, 'sn': sn.value},
onSuccess: function(transport) {
mail.value = transport.responseText;
+ mail_suggest = mail.value;
new Effect.Highlight(mail);
}
});
diff -r fb7131394f05 -r b401723077f1 ipa-server/ipa-gui/ipagui/templates/usershow.kid
--- a/ipa-server/ipa-gui/ipagui/templates/usershow.kid Wed Sep 05 16:59:55 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/usershow.kid Thu Sep 06 11:09:12 2007 -0700
@@ -86,7 +86,7 @@ else:
<th>
<label class="fieldlabel" py:content="fields.nsAccountLock.label" />:
</th>
- <td>${user.get("nsAccountLock")}</td>
+ <td>${userhelper.account_status_display(user.get("nsAccountLock"))}</td>
</tr>
</table>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070906/52f872b2/attachment.bin>
More information about the Freeipa-devel
mailing list