Location: PHPKode > projects > TVEz - Media Library > tvez-0.2.1/html/menu/portlets/movie_search.php
<?php

# ------------------------------------------------------------------------------
#
# Quick Movie Search Portlet
#
# ------------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#                                                                               
# This file is part of TVEz (tvez.sourceforge.net).
#                                                                               
# TVEz 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.
#                                                                               
# TVEz 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 TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#                                                                               
# ------------------------------------------------------------------------------
#
# Created on 02/12/2003 by Christian Eheim (hide@address.com)
#
# LAST MODIFIED:
# $Date: 2004/01/25 02:11:33 $
# $Revision: 1.5 $
# $Author: eheim $
#
# ------------------------------------------------------------------------------

require "movies/search_fields.inc";


	$search = (isset($_REQUEST['search'])) ? $_REQUEST['search'] : "";
	$myfield = (isset($_REQUEST['field'])) ? $_REQUEST['field'] : "all";
	$content = "<script>\n";
	$content .= "function encodeSearch() {\n";
	$content .= "   var searchString = document.searchform.search.value;\n";
	$content .= "   for (var i=0; i<searchString.length; i++) {\n";
	$content .= "       if (searchString.charCodeAt(i) > 128) {\n";
	$content .= "           searchString = searchString.substr(0, i) + \"&#\" + searchString.charCodeAt(i) + \";\" + searchString.substr(i+1)\n";
	$content .= ";\n";
	$content .= "       }\n";
	$content .= "   }\n";
	$content .= "   document.searchform.search.value = searchString;\n";
	$content .= "}\n";
	$content .= "</script>\n";
#	$content = "<div align=center>";
	$content .= '<form METHOD="POST" name="searchform" action="'.$_SERVER['PHP_SELF'].'">';
	$content .= '<input type="text" name="search" value="'.$search.'" size="16">';
	$content .= '<br>';
    $content .= '<select name="field">';
    foreach ( $field_array as $key => $value ) {
        if ($key == $myfield)
            $content .= '<option value="'.$key.'" selected>'.$value.'</option>';
        else
            $content .= '<option value="'.$key.'">'.$value.'</option>';
    }
    $content .= "</select>\n";
	$content .= '<input name="content" type="hidden" value="movies">';
	$content .= '<input name="page" type="hidden" value="movies">';
	$content .= '<br>';
	$content .= '<div align="right"><input name="Reset" type="button" value="'.localize_string("Clear").'" onmousedown="javascript:this.form.search.value=\'\';">';
	$content .= '<input name="Submit" type="submit" onclick="javascript:encodeSearch()" value="'.localize_string("Search").'" title="'.localize_string("Quick Search").'"></div>';
	$content .= '<div align="right"><a href="'.$_SERVER['PHP_SELF'].'?content=movies&page=asearch" title="'.localize_string("Advanced Search").'">'.localize_string("Advanced Search").'</a></div>';
	$content .= '</form>';
#	$content .= '</div>';

	menu(localize_string("Movie Search"),$content);

?>
Return current item: TVEz - Media Library