Location: PHPKode > projects > LDAP Navigator > ldapnavigator-0.9.6/modules/search/form.advanced.php
<?php

/*
	Pagelet - display the LDAP advanced search form
*/

include_once ("./page.header.php");

	// set default values of fields
	( ! isset($searchdn) && isset($dn) ) && $searchdn = $dn;
	isset($searchdn) or $searchdn= $ldapmanager['basedn'];
	isset( $scope ) or  $scope = 'sub';
	isset( $fields) or $fields = "";
	// form starts
	

	echo '<div align=center>';

	html::form( $PHP_SELF, "get", 'name="frm"' );
	html::hidden( 'A', 'search.advanced' );
	
	echo '<table cellspacing=0 style="align:left; padding:4px; border:1px solid gray">';
	echo '<caption>', $config->appName , " > Recherche avancée</caption>\n";

	$wFields = new Popup( "field", $field, $config->searchFields, $sbM );
	$wCustomField = new Textinput( "customfield", $customfield, $tbS );
	$wQuery = new Textinput( "query", $query, $tbS );
	$wOperator = new Popup( "operator", $operator, $searchOperators, $sbM );
	$wDisplayFields = new Textinput( "fields", $fields, $tbL );


	// buttons to shift the search base DN	(left and right)
	$jscode = 'shiftDN(1)';
	$wBtnShiftLeft = new Button( "<-", $jscode, "", $btnZ );

	$jscode = 'shiftDN(-1)';
	$wBtnShiftRight = new Button( "->", $jscode, "", $btnZ );
	// base search DN 
	$wSearchDn = new Textinput( "searchdn", $searchdn, $tbM );
	
	echo "<tr><td class=form colspan=2><table>\n";
	RowN( 
		$wFields,
		"other",
		$wCustomField,
		$wOperator,
		$wQuery
	);
	echo "</table></td></tr>\n";
		
	RowN( 
		"From DN ",
		array(
 			$wBtnShiftLeft,
	 		$wSearchDn,
			$wBtnShiftRight
		)
	);
	
	RowN( 
		"Objectclass:",
		new Textinput( "oc", $oc, $tbM )
	);
	
	$rb = new Radiogroup( "scope", $scope, $searchScopes );
	$rb->useHash( true );
	RowN( 
		"Search depth",
		$rb
	);

	RowN( 
		"Fields to display :",
		$wDisplayFields
	);

/* TODO	(implies dynamically built result rows)
	RowN( 
		"Attributes to display",
		new Textinput( "attrlist", $attrlist, $tbL )
	);
*/
	
	// build and display buttons
	$btn = new Button( "Search", "formAction('search.advanced')", $btS );
	$btn->addOption( " selected " );
	$strBtns = $btn->toString();
	$btn = new Button( "Batch action", "formAction('batch.form')", $btS );
	$strBtns .= $btn->toString();
	$btnBasic = new Button( "Simple...", "formAction('search')", 'Sbasic', $btS );
	
	RowN( 
		$btnBasic,
		$strBtns
	);
		
	echo "</table></div>\n";
	
?>
<script language="javascript">
<!--

var savedDN = null;

function shiftDN( sens ) 
{
	var currentvalue = document.frm.searchdn.value;
	// conserve le DN original dans savedDN
	if( savedDN == null )
		savedDN = currentvalue;
	
	if( sens == 1 ) {

		var pos = currentvalue.indexOf(",");
		if( pos != -1 )
			document.frm.searchdn.value = currentvalue.substr( pos+1, currentvalue.length );

	} else {
		
		var pos = savedDN.lastIndexOf( currentvalue );
		if( pos == -1 )
			return;
		pos = savedDN.lastIndexOf( ",", pos-2 );
		if( pos != -1 ) {
			currentvalue = savedDN.substr( pos+1, savedDN.length );
		} else {
			currentvalue = savedDN;
		}
		document.frm.searchdn.value = currentvalue;
	}
	
}
 
function formAction( actionStr )
{ 	
	document.frm.A.value = actionStr;
	document.frm.submit();
}

function Loadfile( url )
{
	window.location = url;
}

// -->
</script>
<?php


?>
Return current item: LDAP Navigator