printTrail('operator'); $misc->printTitle($lang['strproperties'],'pg.operator'); $misc->printMsg($msg); $oprdata = $data->getOperator($_REQUEST['operator_oid']); $oprdata->fields['oprcanhash'] = $data->phpBool($oprdata->fields['oprcanhash']); if ($oprdata->recordCount() > 0) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; /* these field only exists in 8.2 and before in pg_catalog */ if (isset($oprdata->fields['oprlsortop'])) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } else { echo "\n"; echo "\n"; } echo "
{$lang['strname']}", $misc->printVal($oprdata->fields['oprname']), "
{$lang['strleftarg']}", $misc->printVal($oprdata->fields['oprleftname']), "
{$lang['strrightarg']}", $misc->printVal($oprdata->fields['oprrightname']), "
{$lang['strcommutator']}", $misc->printVal($oprdata->fields['oprcom']), "
{$lang['strnegator']}", $misc->printVal($oprdata->fields['oprnegate']), "
{$lang['strjoin']}", $misc->printVal($oprdata->fields['oprjoin']), "
{$lang['strhashes']}", ($oprdata->fields['oprcanhash']) ? $lang['stryes'] : $lang['strno'], "
{$lang['strmerges']}", ($oprdata->fields['oprlsortop'] !== '0' && $oprdata->fields['oprrsortop'] !== '0') ? $lang['stryes'] : $lang['strno'], "
{$lang['strrestrict']}", $misc->printVal($oprdata->fields['oprrest']), "
{$lang['strleftsort']}", $misc->printVal($oprdata->fields['oprlsortop']), "
{$lang['strrightsort']}", $misc->printVal($oprdata->fields['oprrsortop']), "
{$lang['strlessthan']}", $misc->printVal($oprdata->fields['oprltcmpop']), "
{$lang['strgreaterthan']}", $misc->printVal($oprdata->fields['oprgtcmpop']), "
{$lang['strmerges']}", $data->phpBool($oprdata->fields['oprcanmerge']) ? $lang['stryes'] : $lang['strno'], "
\n"; $misc->printNavLinks(array ( 'showall' => array ( 'attr'=> array ( 'href' => array ( 'url' => 'operators.php', 'urlvars' => array ( 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], 'schema' => $_REQUEST['schema'] ) ) ), 'content' => $lang['strshowalloperators'] )), 'operators-properties', get_defined_vars() ); } else doDefault($lang['strinvalidparam']); } /** * Show confirmation of drop and perform actual drop */ function doDrop($confirm) { global $data, $misc; global $lang; if ($confirm) { $misc->printTrail('operator'); $misc->printTitle($lang['strdrop'], 'pg.operator.drop'); echo "

", sprintf($lang['strconfdropoperator'], $misc->printVal($_REQUEST['operator'])), "

\n"; echo "
\n"; echo "

\n"; echo "

\n"; echo "\n"; echo "\n"; echo $misc->form; echo "\n"; echo "

\n"; echo "
\n"; } else { $status = $data->dropOperator($_POST['operator_oid'], isset($_POST['cascade'])); if ($status == 0) doDefault($lang['stroperatordropped']); else doDefault($lang['stroperatordroppedbad']); } } /** * Show default list of operators in the database */ function doDefault($msg = '') { global $data, $conf, $misc; global $lang; $misc->printTrail('schema'); $misc->printTabs('schema','operators'); $misc->printMsg($msg); $operators = $data->getOperators(); $columns = array( 'operator' => array( 'title' => $lang['stroperator'], 'field' => field('oprname'), 'url' => "operators.php?action=properties&{$misc->href}&", 'vars' => array('operator' => 'oprname', 'operator_oid' => 'oid'), ), 'leftarg' => array( 'title' => $lang['strleftarg'], 'field' => field('oprleftname'), ), 'rightarg' => array( 'title' => $lang['strrightarg'], 'field' => field('oprrightname'), ), 'returns' => array( 'title' => $lang['strreturns'], 'field' => field('resultname'), ), 'actions' => array( 'title' => $lang['stractions'], ), 'comment' => array( 'title' => $lang['strcomment'], 'field' => field('oprcomment'), ), ); $actions = array( 'drop' => array( // 'title' => $lang['strdrop'], // 'url' => "operators.php?action=confirm_drop&{$misc->href}&", // 'vars' => array('operator' => 'oprname', 'operator_oid' => 'oid'), 'content' => $lang['strdrop'], 'attr'=> array ( 'href' => array ( 'url' => 'operators.php', 'urlvars' => array ( 'action' => 'confirm_drop', 'operator' => field('oprname'), 'operator_oid' => field('oid') ) ) ) ) ); $misc->printTable($operators, $columns, $actions, 'operators-operators', $lang['strnooperators']); // TODO operators.php action=create $lang['strcreateoperator'] } /** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; $operators = $data->getOperators(); // Operator prototype: "type operator type" $proto = concat(field('oprleftname'), ' ', field('oprname'), ' ', field('oprrightname')); $reqvars = $misc->getRequestVars('operator'); $attrs = array( 'text' => $proto, 'icon' => 'Operator', 'toolTip'=> field('oprcomment'), 'action' => url('operators.php', $reqvars, array( 'action' => 'properties', 'operator' => $proto, 'operator_oid' => field('oid') ) ) ); $misc->printTree($operators, $attrs, 'operators'); exit; } if ($action == 'tree') doTree(); $misc->printHeader($lang['stroperators']); $misc->printBody(); switch ($action) { case 'save_create': if (isset($_POST['cancel'])) doDefault(); else doSaveCreate(); break; case 'create': doCreate(); break; case 'drop': if (isset($_POST['cancel'])) doDefault(); else doDrop(false); break; case 'confirm_drop': doDrop(true); break; case 'properties': doProperties(); break; default: doDefault(); break; } $misc->printFooter(); ?>