fhiiqm/test/partner_select.php
author Bettina Schwarzer <schwarzer@fhi-berlin.mpg.de>
Wed, 31 Aug 2011 14:22:19 +0200
changeset 1 6288d5685bff
permissions -rw-r--r--
Stand v. 31.08.2011

<?php

/**
 * @author Bettina Schwarzer, Fritz-Haber-Institut
 * @copyright 06/2011
 *
 * Suche Vertraege und Anzeige Updateformular
 */

    error_reporting(E_ALL ^ E_NOTICE);
    
	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
	$dbc = new dbconnection();

//    $cid = $_POST["con_id"];
    $pname = $_POST["partname"];
    $pid = trim(substr($pname,0,strpos($pname,"-")));
/*
    if (isset($cid) && $cid) 
        header("Location: http://achilleus/fhiiqm/vertrag_upd.php?uid=$cid");
    else
*/
    {
?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        
        <head>
        	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
           	<link href="../css/db.css" rel="STYLESHEET" type="TEXT/CSS" /> 
            <link rel="stylesheet" type="text/css" href="/fhiiqm/css/jquery/jquery.autocomplete.css" /> 
            
<!--            <script type="text/javascript" src="js/jquery/jquery.js"></script>  -->
            <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.6.2.min.js"></script>
            <script type="text/javascript" src="/fhiiqm/js/jquery/jquery.autocomplete.js"></script>
             
            <style type="text/css">
            .ac_input {
            	width: 400px;
            }
            .ac_results {
            	width: 400px;
            	background: #BCEEFB;
            	cursor: pointer;
            	position: absolute;
            	left: 0;
            	font-size: 70%;
            	z-index: 101;
            }
            .ac_results ul {
            	width: 400px;
            	list-style: none;
            	padding: 0px;
            	margin: 0px;
            	border: 1px solid #000;
            }
            .ac_results li {
            	width: 400px;
            	padding: 2px 5px;
            }
            .ac_results a {
            	width: 100%;
            }
            /* thanks udoline: this fixed position error into msie */
            .ac_results iframe {
            	width: 400px;
            	position: absolute;
            }
            .ac_loading {
/*            	background : url('/indicator.gif') right center no-repeat; */
            	background : url('img/jquery/loading.gif') right center no-repeat;
            }
            .over {
            	background: yellow;
            	color: #FFAA00;
            }
            </style></head>
        
        	<title>Suche Partner</title>
        </head>
        
        <body onload="document.fpartner.partname.focus();">
        <div class="float-r"><img src="../img/document_mark_as_final.png" border="0" alt="Vertragssuche" title="Vertragssuche"/></div>
        <div align="center">
        <h3>Partnersuche</h3>
    	       <table>   
        		<tr><td class="bigger">Bitte Partnerbezeichnung oder Teil davon eingeben und dann Partner</td></tr> 
                <tr><td class="bigger">aus angebotener Liste durch Anklicken w&auml;hlen:</td></tr>   
            	<form name="fpartner" id="fpartner" action="<?php $_SERVER['PHP_SELF']?>" method="post" enctype="application/x-www-form-urlencoded">
                <!-- <input type="hidden" name="con_id">  -->
                <tr><td><input id="partname" name="partname" type="text" value="<?php echo $pname; ?>"/>
        		</td></tr>
            	</form> 
                <tr><td>Falls keine Liste angezeigt wird, existiert kein Partner mit den eingegebenen Zeichen!</td></tr>
        	   </table>
        	 
        	<script type="text/javascript">
        	function selectItem(li) {
        		// hier Übergabe ID und Verweis auf Seite
        		document.fpartner.submit();
        		return false;
        	}
        	
        	function pickedpart( li ) {
        	//  document.fcontract.con_id.value = li.data;
        	  document.fpartner.partname.value = li.data;
        	}
        	
        	function formatItem(row) {
        		return row[0];
        	}
        	
        	$(document).ready(function() {
        		$("#partname").autocomplete("partner_list_autocomplete.php", { 
        			minChars:2, 
        			matchSubset:1, 
        			matchContains:1, 
        			cacheLength:20, 
        	//		onItemSelect:selectItem, 
        			onItemSelect:pickedpart, 
        			formatItem:formatItem, 
        			selectOnly:1 
        		});
        	});
        	</script>
        </div>
        </body>
        </html>
<?php        
    }
?>