[vhffs-dev] [1073] Rationalized some templates names ( please make uninstall in vhffs-public dir).

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1073
Author:   beuss
Date:     2007-11-08 19:20:08 +0000 (Thu, 08 Nov 2007)

Log Message:
-----------
Rationalized some templates names (please make uninstall in vhffs-public dir).
User search is now working!

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/User.pm
    trunk/vhffs-public/Makefile.am
    trunk/vhffs-public/allgroups.pl
    trunk/vhffs-public/allwebsites.pl
    trunk/vhffs-public/lastgroups.pl
    trunk/vhffs-public/lastusers.pl
    trunk/vhffs-public/templates/Makefile.am
    trunk/vhffs-public/templates/index.tmpl
    trunk/vhffs-public/websearch.pl

Added Paths:
-----------
    trunk/vhffs-public/templates/groupslist.tmpl
    trunk/vhffs-public/templates/userslist.tmpl
    trunk/vhffs-public/templates/websiteslist.tmpl

Removed Paths:
-------------
    trunk/vhffs-public/templates/allwebsites.tmpl
    trunk/vhffs-public/templates/lastgroups.tmpl
    trunk/vhffs-public/templates/lastusers.tmpl


Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm	2007-11-08 19:20:08 UTC (rev 1073)
@@ -132,28 +132,38 @@
 }
 
 sub public_search {
-    my ($main, $username, $firstname, $lastname) = @_;
+    my ($main, $username, $firstname, $lastname, $start, $count) = @_;
+    my $result = {};
 
-    my $sql = 'SELECT u.uid, u.username, u.firstname, u.lastname FROM vhffs_users u INNER JOIN vhffs_object ON o.objectid = u.object_id WHERE o.state = ?';
+    my $select_clause = 'SELECT u.uid, u.username, u.firstname, u.lastname';
+    my $restriction = ' FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id WHERE o.state = ?';
     my @params;
 
     if(defined $username) {
-        $sql .= ' AND username LIKE ?';
-        push @params, '%'.$username.'%';
+        # usernames are enforced in lowercase
+        $restriction .= ' AND username LIKE ?';
+        push @params, '%'.lc($username).'%';
     }
 
     if(defined $firstname) {
-        $sql .= ' AND firstname LIKE ?';
+        $restriction .= ' AND UPPER(firstname) LIKE UPPER(?)';
         push @params, '%'.$firstname.'%';
     }
 
     if(defined $lastname) {
-        $sql .= ' AND lastname LIKE ?';
+        $restriction .= ' AND UPPER(lastname) LIKE UPPER(?)';
         push @params, '%'.$lastname.'%';
     }
 
+    my $order = ' ORDER BY u.username LIMIT ? OFFSET ?';
+    push @params, $count, $start;
+
     my $dbh = $main->get_db_object;
-    return $dbh->selectall_arrayref($sql, { Slice => {} }, Vhffs::Constants::ACTIVATED, @params);
+    $result->{users} = $dbh->selectall_arrayref($select_clause.$restriction.$order, { Slice => {} }, Vhffs::Constants::ACTIVATED, @params);
+    $select_clause = 'SELECT COUNT(*)';
+    pop @params; pop @params;
+    ($result->{total_count}) = @{$dbh->selectrow_arrayref($select_clause.$restriction, undef, Vhffs::Constants::ACTIVATED, @params)};
+    return $result;
 }
 
 sub set_lang

Modified: trunk/vhffs-public/Makefile.am
===================================================================
--- trunk/vhffs-public/Makefile.am	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/Makefile.am	2007-11-08 19:20:08 UTC (rev 1073)
@@ -11,6 +11,7 @@
 	lastgroups.pl \
 	lastusers.pl \
 	user.pl \
+	usersearch.pl \
 	websearch.pl \
 	rss/lastgroups.pl \
 	rss/lastusers.pl

Modified: trunk/vhffs-public/allgroups.pl
===================================================================
--- trunk/vhffs-public/allgroups.pl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/allgroups.pl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -60,7 +60,7 @@
 undef $letter if( $letter eq 'all');
 my $groups = Vhffs::Panel::Group::get_groups_starting_with( $vhffs , $letter );
 my $output_final="";
-my $maintemplate = new Vhffs::Panel::Template( filename => $templatedir."/public/lastgroups.tmpl", die_on_bad_params => 0, loop_context_vars => 1 );
+my $maintemplate = new Vhffs::Panel::Template( filename => $templatedir."/public/groupslist.tmpl", die_on_bad_params => 0, loop_context_vars => 1 );
 
 my $hostname = $vhffs->get_config->get_host_name;
 

Modified: trunk/vhffs-public/allwebsites.pl
===================================================================
--- trunk/vhffs-public/allwebsites.pl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/allwebsites.pl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -60,7 +60,7 @@
 my $maintemplate;
 my $hostname = $vhffs->get_config->get_host_name;
 
-$maintemplate = new Vhffs::Panel::Template( filename => $templatedir."/public/allwebsites.tmpl" );
+$maintemplate = new Vhffs::Panel::Template( filename => $templatedir."/public/websiteslist.tmpl" );
 
 
 $maintemplate->param( TEXT_TITLE => sprintf( gettext("All websites on %s") , $hostname ) );

Modified: trunk/vhffs-public/lastgroups.pl
===================================================================
--- trunk/vhffs-public/lastgroups.pl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/lastgroups.pl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -51,7 +51,7 @@
 $panel->check_public();
 
 my $groups = Vhffs::Panel::Group::get_last_groups( $vhffs );
-my $template = new Vhffs::Panel::Template( filename => $templatedir."/public/lastgroups.tmpl", global_var => 1, die_on_bad_params => 0, loop_context_vars => 1);
+my $template = new Vhffs::Panel::Template( filename => $templatedir."/public/groupslist.tmpl", global_var => 1, die_on_bad_params => 0, loop_context_vars => 1);
 
 my $hostname = $vhffs->get_config->get_host_name;
 

Modified: trunk/vhffs-public/lastusers.pl
===================================================================
--- trunk/vhffs-public/lastusers.pl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/lastusers.pl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -56,7 +56,7 @@
 my $hostname = $vhffs->get_config->get_host_name;
 
 
-$template = new Vhffs::Panel::Template( filename => $templatedir."/public/lastusers.tmpl", global_var => 1, die_on_bad_params => 0, loop_context_vars => 1 );
+$template = new Vhffs::Panel::Template( filename => $templatedir."/public/userslist.tmpl", global_var => 1, die_on_bad_params => 0, loop_context_vars => 1 );
 $template->param( TEXT_TITLE => sprintf( gettext("Last users on %s") , $hostname ) );
 $template->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
 $template->param( USE_AVATAR => $panel->use_users_avatars );

Modified: trunk/vhffs-public/templates/Makefile.am
===================================================================
--- trunk/vhffs-public/templates/Makefile.am	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/templates/Makefile.am	2007-11-08 19:20:08 UTC (rev 1073)
@@ -1,12 +1,10 @@
 publictemplatesdir = @TEMPLATESDIR@/public
 nobase_publictemplates_DATA = \
-	allwebsites.tmpl \
 	banner.tmpl \
 	group_part.tmpl \
 	group.tmpl \
+	groupslist.tmpl \
 	index.tmpl \
-	lastgroups.tmpl \
-	lastusers.tmpl \
 	misc/cvs-part.tmpl \
 	misc/lastgroups-part.tmpl \
 	misc/lastusers-part.tmpl \
@@ -16,4 +14,6 @@
 	misc/web-part.tmpl \
 	simplemsg.tmpl \
 	user_part.tmpl \
-	user.tmpl
+	user.tmpl \
+	userslist.tmpl \
+	websiteslist.tmpl

Deleted: trunk/vhffs-public/templates/allwebsites.tmpl
===================================================================
--- trunk/vhffs-public/templates/allwebsites.tmpl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/templates/allwebsites.tmpl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -1,18 +0,0 @@
-<TMPL_INCLUDE NAME="banner.tmpl">
-
-<div id="public">
-<h1><TMPL_VAR ESCAPE=1 NAME="TEXT_TITLE"></h1>
-<p style="text-align:center">
-<TMPL_LOOP name="LETTERS">
-[<a href="/allwebsites.pl?letter=<TMPL_VAR ESCAPE=1 name="letter">" title="<TMPL_VAR ESCAPE=1 name="count"> <TMPL_I18N KEY="website(s)">"><TMPL_VAR ESCAPE=1 name="letter"></a>]&nbsp;
-</TMPL_LOOP>
-[<a href="/allwebsites.pl?letter=all"><TMPL_VAR ESCAPE=1 name="ALL"></a>]
-</p>
-<TMPL_IF NAME="WEBSITES">
-<TMPL_INCLUDE NAME="misc/web-part.tmpl">
-<TMPL_ELSE>
-<p style="text-align:center;font-weight:bold;">
-<TMPL_I18N KEY="No websites">
-</p>
-</TMPL_IF>
-</div>

Copied: trunk/vhffs-public/templates/groupslist.tmpl (from rev 1070, trunk/vhffs-public/templates/lastgroups.tmpl)
===================================================================
--- trunk/vhffs-public/templates/groupslist.tmpl	                        (rev 0)
+++ trunk/vhffs-public/templates/groupslist.tmpl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -0,0 +1,17 @@
+<TMPL_INCLUDE NAME="banner.tmpl">
+
+<div id="public">
+<h1><TMPL_VAR ESCAPE=1 NAME="TEXT_TITLE"></h1>
+<TMPL_IF NAME="LETTERS">
+<p style="text-align:center">
+<TMPL_LOOP NAME="LETTERS">
+[<a href="/allgroups.pl?letter=<TMPL_VAR ESCAPE=1 NAME="letter">"><TMPL_VAR ESCAPE=1 NAME="letter"></a>]&nbsp;
+</TMPL_LOOP>
+[<a href="/allgroups.pl?letter=all"><TMPL_VAR ESCAPE=1 NAME="ALL"></a>]
+</p>
+<TMPL_IF NAME="MESSAGE">
+<p style="text-align:center;font-weight:bold;"><TMPL_VAR ESCAPE=1 NAME="MESSAGE"></p>
+</TMPL_IF>
+</TMPL_IF>
+<TMPL_INCLUDE NAME="misc/lastgroups-part.tmpl">
+</div>

Modified: trunk/vhffs-public/templates/index.tmpl
===================================================================
--- trunk/vhffs-public/templates/index.tmpl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/templates/index.tmpl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -8,11 +8,11 @@
     </ul>
     <fieldset>
         <legend><TMPL_I18N KEY="Search an user"></legend>
-        <form method="post" action="/searchuser.pl">
+        <form method="post" action="/usersearch.pl">
             <p><label for="search_username"><TMPL_I18N KEY="Username">:</label>
                 <input type="text" name="username" id="search_username"/></p>
             <p><label for="search_firstname"><TMPL_I18N KEY="Firstname">:</label>
-                <input type="text" name="first" id="search_firstname"/></p>
+                <input type="text" name="firstname" id="search_firstname"/></p>
             <p><label for="search_lastname"><TMPL_I18N KEY="Lastname">:</label>
                 <input type="text" name="lastname" id="search_lastname"/></p>
             <p><input type="submit" name="search_user_submit" value="<TMPL_I18N KEY="Search">"/></p>
@@ -26,7 +26,7 @@
     </ul>
     <fieldset>
         <legend><TMPL_I18N KEY="Search a group"></legend>
-        <form method="post" action="/group.pl">
+        <form method="post" action="/groupsearch.pl">
             <p><label for="search_groupname"><TMPL_I18N KEY="Groupname">:</label>
                 <input type="text" name="groupname" id="search_groupname"/></p>
             <p><label for="search_description"><TMPL_I18N KEY="Description contains">:</label>
@@ -41,7 +41,7 @@
     </ul>
     <fieldset>
         <legend><TMPL_I18N KEY="Search a website"></legend>
-        <form method="post" action="/website.pl">
+        <form method="post" action="/websitesearch.pl">
             <p><label for="search_servername"><TMPL_I18N KEY="Website name">:</label>
                 <input type="text" name="servername" id="search_servername"/></p>
             <p><input type="submit" name="search_website_submit" value="<TMPL_I18N KEY="Search">"/></p>

Deleted: trunk/vhffs-public/templates/lastgroups.tmpl
===================================================================
--- trunk/vhffs-public/templates/lastgroups.tmpl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/templates/lastgroups.tmpl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -1,17 +0,0 @@
-<TMPL_INCLUDE NAME="banner.tmpl">
-
-<div id="public">
-<h1><TMPL_VAR ESCAPE=1 NAME="TEXT_TITLE"></h1>
-<TMPL_IF NAME="LETTERS">
-<p style="text-align:center">
-<TMPL_LOOP NAME="LETTERS">
-[<a href="/allgroups.pl?letter=<TMPL_VAR ESCAPE=1 NAME="letter">"><TMPL_VAR ESCAPE=1 NAME="letter"></a>]&nbsp;
-</TMPL_LOOP>
-[<a href="/allgroups.pl?letter=all"><TMPL_VAR ESCAPE=1 NAME="ALL"></a>]
-</p>
-<TMPL_IF NAME="MESSAGE">
-<p style="text-align:center;font-weight:bold;"><TMPL_VAR ESCAPE=1 NAME="MESSAGE"></p>
-</TMPL_IF>
-</TMPL_IF>
-<TMPL_INCLUDE NAME="misc/lastgroups-part.tmpl">
-</div>

Deleted: trunk/vhffs-public/templates/lastusers.tmpl
===================================================================
--- trunk/vhffs-public/templates/lastusers.tmpl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/templates/lastusers.tmpl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -1,27 +0,0 @@
-<TMPL_INCLUDE NAME="banner.tmpl">
-
-<div id="public">
-
-<h1><TMPL_VAR ESCAPE=1 NAME="TEXT_TITLE"></h1>
-<TMPL_LOOP NAME="USERS">
-<h2><TMPL_VAR ESCAPE=1 NAME="USERNAME"></h2>
-<TMPL_IF NAME="USE_AVATAR">
-<img src="/getavatar.pl?oid=<TMPL_VAR ESCAPE=1 NAME="OBJECT_ID">" alt="<TMPL_VAR ESCAPE=1 NAME="USERNAME"> avatar" class="avatar"/>
-</TMPL_IF>
-<ul>
-<li>
-<TMPL_I18N KEY="Username">: <TMPL_VAR ESCAPE=1 NAME="USERNAME">
-</li>
-<li>
-<TMPL_I18N KEY="Firstname">: <TMPL_VAR ESCAPE=1 NAME="FIRSTNAME">
-</li>
-<li>
-<TMPL_I18N KEY="Lastname">: <TMPL_VAR ESCAPE=1 NAME="LASTNAME">
-</li>
-<li>
-<TMPL_INCLUDE NAME="group_part.tmpl">
-</li>
-</ul>
-<div class="clear"></div>
-</TMPL_LOOP>
-</div>

Copied: trunk/vhffs-public/templates/userslist.tmpl (from rev 1070, trunk/vhffs-public/templates/lastusers.tmpl)
===================================================================
--- trunk/vhffs-public/templates/userslist.tmpl	                        (rev 0)
+++ trunk/vhffs-public/templates/userslist.tmpl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -0,0 +1,38 @@
+<TMPL_INCLUDE NAME="banner.tmpl">
+
+<div id="public">
+
+<h1><TMPL_VAR ESCAPE=1 NAME="TEXT_TITLE"></h1>
+<TMPL_IF NAME="PAGES">
+    <TMPL_IF NAME="PREVIOUS_PAGE">
+        <a href="?page=<TMPL_VAR NAME="PREVIOUS_PAGE"><TMPL_IF NAME="SEARCH_CRITERIA">&amp;<TMPL_VAR NAME="SEARCH_CRITERIA"></TMPL_IF>">&lt;&lt;</a>
+    </TMPL_IF>
+    <TMPL_LOOP NAME="PAGES">
+        <a href="?page=<TMPL_VAR NAME="PAGE"><TMPL_IF NAME="SEARCH_CRITERIA">&amp;<TMPL_VAR NAME="SEARCH_CRITERIA"></TMPL_IF>"><TMPL_VAR NAME="PAGE"></a>
+    </TMPL_LOOP>
+    <TMPL_IF NAME="NEXT_PAGE">
+        <a href="?page=<TMPL_VAR NAME="NEXT_PAGE"><TMPL_IF NAME="SEARCH_CRITERIA">&amp;<TMPL_VAR NAME="SEARCH_CRITERIA"></TMPL_IF>">&gt;&gt;</a>
+    </TMPL_IF>
+</TMPL_IF>
+<TMPL_LOOP NAME="USERS">
+<h2><TMPL_VAR ESCAPE=1 NAME="USERNAME"></h2>
+<TMPL_IF NAME="USE_AVATAR">
+<img src="/getavatar.pl?oid=<TMPL_VAR ESCAPE=1 NAME="OBJECT_ID">" alt="<TMPL_VAR ESCAPE=1 NAME="USERNAME"> avatar" class="avatar"/>
+</TMPL_IF>
+<ul>
+<li>
+<TMPL_I18N KEY="Username">: <TMPL_VAR ESCAPE=1 NAME="USERNAME">
+</li>
+<li>
+<TMPL_I18N KEY="Firstname">: <TMPL_VAR ESCAPE=1 NAME="FIRSTNAME">
+</li>
+<li>
+<TMPL_I18N KEY="Lastname">: <TMPL_VAR ESCAPE=1 NAME="LASTNAME">
+</li>
+<li>
+<TMPL_INCLUDE NAME="group_part.tmpl">
+</li>
+</ul>
+<div class="clear"></div>
+</TMPL_LOOP>
+</div>

Copied: trunk/vhffs-public/templates/websiteslist.tmpl (from rev 1070, trunk/vhffs-public/templates/allwebsites.tmpl)
===================================================================
--- trunk/vhffs-public/templates/websiteslist.tmpl	                        (rev 0)
+++ trunk/vhffs-public/templates/websiteslist.tmpl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -0,0 +1,18 @@
+<TMPL_INCLUDE NAME="banner.tmpl">
+
+<div id="public">
+<h1><TMPL_VAR ESCAPE=1 NAME="TEXT_TITLE"></h1>
+<p style="text-align:center">
+<TMPL_LOOP name="LETTERS">
+[<a href="/allwebsites.pl?letter=<TMPL_VAR ESCAPE=1 name="letter">" title="<TMPL_VAR ESCAPE=1 name="count"> <TMPL_I18N KEY="website(s)">"><TMPL_VAR ESCAPE=1 name="letter"></a>]&nbsp;
+</TMPL_LOOP>
+[<a href="/allwebsites.pl?letter=all"><TMPL_VAR ESCAPE=1 name="ALL"></a>]
+</p>
+<TMPL_IF NAME="WEBSITES">
+<TMPL_INCLUDE NAME="misc/web-part.tmpl">
+<TMPL_ELSE>
+<p style="text-align:center;font-weight:bold;">
+<TMPL_I18N KEY="No websites">
+</p>
+</TMPL_IF>
+</div>

Modified: trunk/vhffs-public/websearch.pl
===================================================================
--- trunk/vhffs-public/websearch.pl	2007-11-08 12:26:03 UTC (rev 1072)
+++ trunk/vhffs-public/websearch.pl	2007-11-08 19:20:08 UTC (rev 1073)
@@ -68,7 +68,7 @@
 
 
 my $webs = Vhffs::Services::Web::search( $vhffs  , Vhffs::Constants::ACTIVATED , $name );
-$maintemplate = new HTML::Template( filename => $templatedir."/public/allwebsites.tmpl" );
+$maintemplate = new HTML::Template( filename => $templatedir."/public/websiteslist.tmpl" );
 
 
 setlocale(LC_ALL, CGI->cookie("language") );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/