Added some ability to test searching.

This commit is contained in:
paul 2007-03-01 15:59:53 +00:00
parent 874bc204b5
commit 982255503a

View file

@ -213,9 +213,24 @@ if (isset($_REQUEST['go_button'])) {
$methodParams = $methodDefs[$f_selectedMethod]['p']; $methodParams = $methodDefs[$f_selectedMethod]['p'];
foreach ($methodParams as $methodParamName) { foreach ($methodParams as $methodParamName) {
$inputParamName = "param_".$methodParamName; $inputParamName = "param_".$methodParamName;
if ($methodParamName == "criteria") {
$catInputName = $inputParamName."_condition_cat";
$valInputName = $inputParamName."_condition_val";
$conditions = array();
$conditions[0]["cat"] = $_REQUEST[$catInputName];
$conditions[0]["op"] = "=";
$conditions[0]["val"] = $_REQUEST[$valInputName];
$criteriaArray = array(
"filetype" => "audioclip",
"conditions" => $conditions);
$xmlParameters[$methodParamName] = $criteriaArray;
$_SESSION[$catInputName] = $_REQUEST[$catInputName];
$_SESSION[$valInputName] = $_REQUEST[$valInputName];
} else {
$xmlParameters[$methodParamName] = $_REQUEST[$inputParamName]; $xmlParameters[$methodParamName] = $_REQUEST[$inputParamName];
$_SESSION[$inputParamName] = $_REQUEST[$inputParamName]; $_SESSION[$inputParamName] = $_REQUEST[$inputParamName];
} }
}
// Create the XML-RPC message // Create the XML-RPC message
$actualMethod = $methodDefs[$f_selectedMethod]['m']; $actualMethod = $methodDefs[$f_selectedMethod]['m'];
@ -230,6 +245,11 @@ if (isset($_REQUEST['go_button'])) {
// If successful // If successful
$xmlResponse = XML_RPC_decode($sendResult->value()); $xmlResponse = XML_RPC_decode($sendResult->value());
if (isset($xmlResponse['token'])) {
$_SESSION['xmlrpc_token'] = $xmlResponse['token'];
$errorMsg .= "<br>*** Token saved<br>";
}
// Special case state handling // Special case state handling
switch ($f_selectedMethod) { switch ($f_selectedMethod) {
case "login": case "login":
@ -242,7 +262,6 @@ if (isset($_REQUEST['go_button'])) {
unset($_SESSION['xmlrpc_session_id']); unset($_SESSION['xmlrpc_session_id']);
break; break;
case "storeAudioClipOpen": case "storeAudioClipOpen":
$_SESSION['xmlrpc_token'] = $xmlResponse['token'];
$_SESSION['xmlrpc_put_url'] = $xmlResponse['url']; $_SESSION['xmlrpc_put_url'] = $xmlResponse['url'];
break; break;
} }
@ -322,17 +341,46 @@ if (!is_array($methodParams) || count($methodParams) == 0) {
} else { } else {
echo "<table cellpadding=3>"; echo "<table cellpadding=3>";
foreach ($methodParams as $methodParamName) { foreach ($methodParams as $methodParamName) {
// Get the value for the field
$value = ""; $value = "";
if ($methodParamName == "sessid" && isset($_SESSION['xmlrpc_session_id'])) { if ($methodParamName == "sessid" && isset($_SESSION['xmlrpc_session_id'])) {
$value = $_SESSION['xmlrpc_session_id']; $value = $_SESSION['xmlrpc_session_id'];
} elseif ($methodParamName == "token" && isset($_SESSION['xmlrpc_token'])) { } elseif ($methodParamName == "token" && isset($_SESSION['xmlrpc_token'])) {
$value = $_SESSION['xmlrpc_token']; $value = $_SESSION['xmlrpc_token'];
} elseif ($methodParamName == "criteria") {
$value_cond_cat = $_SESSION["param_".$methodParamName."_condition_cat"];
$value_cond_val = $_SESSION["param_".$methodParamName."_condition_val"];
} elseif (isset($_SESSION["param_".$methodParamName])) { } elseif (isset($_SESSION["param_".$methodParamName])) {
$value = $_SESSION["param_".$methodParamName]; $value = $_SESSION["param_".$methodParamName];
} }
// Display the input boxes for the given field
echo "<tr>"; echo "<tr>";
echo "<td>$methodParamName</td>"; ?> <td><INPUT type="text" name="param_<?php echo $methodParamName; ?>" value="<?php echo $value; ?>"><td></tr> if ($methodParamName == "criteria") {
?>
<td><?php echo $methodParamName; ?></td>
<td>
<table>
<tr>
<td>
<select name="param_<?php echo $methodParamName; ?>_condition_cat">
<option value="dc:creator" <?php if ($value_cond_cat == "dc:creator") { ?>selected<?php } ?>>artist</option>
<option value="dc:source"<?php if ($value_cond_cat == "dc:source") { ?>selected<?php } ?>>album</option>
<option value="dc:title" <?php if ($value_cond_cat == "dc:title") { ?>selected<?php } ?>>title</option>
</select>
<td>=</td>
<td><INPUT type="text" name="param_<?php echo $methodParamName; ?>_condition_val" value="<?php echo $value_cond_val; ?>"><td>
</tr>
</table>
</td>
<?php <?php
} else {
?>
<td><?php echo $methodParamName; ?></td>
<td><INPUT type="text" name="param_<?php echo $methodParamName; ?>" value="<?php echo $value; ?>"><td>
<?php
}
echo "</tr>";
} }
echo "</table>"; echo "</table>";
} }