[phpwebapp-commits] CVS: top10/templates/admin/users/filter user_filter.js,NONE,1.1.2.1 user_filter.
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2004-02-07 15:55:43
|
Update of /cvsroot/phpwebapp/top10/templates/admin/users/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30579/templates/admin/users/filter Modified Files: Tag: maisp user_filter.php user_filter.html Added Files: Tag: maisp user_filter.js user_filter.css Log Message: filter user list --- NEW FILE: user_filter.js --- // -*-C-*- //tell emacs to use C mode /* This file is part of Top10. Top10 is a web application for ranking and evaluating free software projects. Copyright (C) 2003, 2004 Dashamir Hoxha, das...@us... Top10 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Top10 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Top10; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ function set_filter_var(txtbox) { var var_name = "user_filter->" + txtbox.name; session.setVar(var_name, txtbox.value); } function set_status(listbox) { var var_name = "user_filter->" + listbox.name; var var_value = listbox.options[listbox.selectedIndex].value; session.setVar(var_name, var_value); } function refresh() { SendEvent('user_filter','refresh'); } --- NEW FILE: user_filter.css --- .filter_input { border: 1px solid #dddddd; } Index: user_filter.php =================================================================== RCS file: /cvsroot/phpwebapp/top10/templates/admin/users/filter/Attic/user_filter.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** user_filter.php 2 Feb 2004 15:38:46 -0000 1.1.2.1 --- user_filter.php 7 Feb 2004 14:23:58 -0000 1.1.2.2 *************** *** 25,32 **** function init() { ! $this->addSVar("username", ""); ! $this->addSVar("realname", ""); ! $this->addSVar("email", ""); ! $this->addSVar("status", ""); } } --- 25,66 ---- function init() { ! $this->addSVar('username', ''); ! $this->addSVar('realname', ''); ! $this->addSVar('email', ''); ! $this->addSVar('status', ''); ! $this->addSVar('condition', '(1=1)'); ! } ! ! function on_refresh() ! { ! //get filter variables ! $username = $this->getSVar('username'); ! $realname = $this->getSVar('realname'); ! $email = $this->getSVar('email'); ! $status = $this->getSVar('status'); ! ! //build the filter condition ! $arr_conditions = array(); ! if ($username<>'') $arr_conditions[] = "username like '%$username%'"; ! if ($realname<>'') $arr_conditions[] = "realname like '%$realname%'"; ! if ($email<>'') $arr_conditions[] = "email like '%$email%'"; ! if ($status<>'') $arr_conditions[] = "status='$status'"; ! ! $condition = implode(' AND ', $arr_conditions); ! if ($condition=='') $condition = '(1=1)'; ! ! //save it ! $this->setSVar('condition', $condition); ! } ! ! function onRender() ! { ! //build the recordset used by the 'status' listbox ! $rs = new EditableRS('status'); ! $rs->addRec(array('id'=>'private', 'label'=>'private')); ! $rs->addRec(array('id'=>'public', 'label'=>'public')); ! //add it to the page ! global $webPage; ! $webPage->addRecordset($rs); } } Index: user_filter.html =================================================================== RCS file: /cvsroot/phpwebapp/top10/templates/admin/users/filter/Attic/user_filter.html,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** user_filter.html 2 Feb 2004 15:38:47 -0000 1.1.2.1 --- user_filter.html 7 Feb 2004 14:23:59 -0000 1.1.2.2 *************** *** 1,3 **** --- 1,6 ---- <WebBox ID="user_filter"> + + <Include SRC="{{LISTBOX_PATH}}listbox.html" /> + <table width="100%" cellspacing="1" cellpadding="0" bgcolor="#dddddd"> <tr><td bgcolor="#eeeeee"> *************** *** 8,30 **** <td> <input type="text" name="username" value="{{username}}" ! size="10" onfocus="select()" /> </td> <td align="right">Real Name:</td> <td> <input type="text" name="realname" value="{{realname}}" ! size="10" onfocus="select()" /> </td> <td align="right">E-mail:</td> <td> <input type="text" name="email" value="{{email}}" ! size="10" onfocus="select()" /> </td> <td align="right">Status:</td> <td> ! <input type="text" name="status" value="{{status}}" ! size="10" onfocus="select()" /> </td> <td align="center"> ! <a class="button" href="javascript:GoTo('thisPage')">Refresh</a> </td> </tr> --- 11,37 ---- <td> <input type="text" name="username" value="{{username}}" ! size="10" class="filter_input" ! onfocus="select()" onblur="set_filter_var(this)" /> </td> <td align="right">Real Name:</td> <td> <input type="text" name="realname" value="{{realname}}" ! size="10" class="filter_input" ! onfocus="select()" onblur="set_filter_var(this)" /> </td> <td align="right">E-mail:</td> <td> <input type="text" name="email" value="{{email}}" ! size="10" class="filter_input" ! onfocus="select()" onblur="set_filter_var(this)" /> </td> <td align="right">Status:</td> <td> ! <WebObject Class="listbox" Name="status" ! rs="status" value="{{status}}" ! onchange="set_status(this)" /> </td> <td align="center"> ! <a class="button" href="javascript:refresh()">Refresh</a> </td> </tr> |