Esempio n. 1
0
while (!$done && (list($key, $mediarange) = each($accept))) {
    if ($mediarange == 'text/turtle') {
        deliverTurtle();
        $done = TRUE;
    }
    if ($mediarange == 'application/rdf+xml') {
        deliverRdfXml();
        $done = TRUE;
    }
}
if (!$done) {
    Header("Content-Type: text/html; charset=" . $charset);
    $spDisplay = " Agent: " . $agent->getMinimalName();
    pageheader($agent);
    $am = new AgentManager();
    if ($am->isAgentEditor()) {
        echo "<div id='commandDiv'><span class='link' id='editLink'>Edit</span>&nbsp;<span class='link' id='viewLink'>View</span>&nbsp;<span class='link' id='createLink'>New</span></div>";
        echo "\n     <script type='text/javascript'>\n        \$('#editLink').click(function () {\n            \$.ajax({\n               type: 'GET',\n               url: '{$clientRoot}/agents/rpc/handler.php',\n               data: 'mode=edit&table=Agent&agentid=" . $agent->getagentid() . "',\n               dataType : 'html',\n               success: function(data){\n                  \$('#agentDetailDiv" . $agent->getagentid() . "').html(data);\n               },\n               error: function( xhr, status, errorThrown ) {\n                  \$('#statusDiv').html('Error. ' + errorThrown);\n                  console.log( 'Error: ' + errorThrown );\n                  console.log( 'Status: ' + status );\n                  console.dir( xhr );\n               }\n            });\n            return false; \n        });\n        \$('#viewLink').click(function () {\n            \$.ajax({\n               type: 'GET',\n               url: '{$clientRoot}/agents/rpc/handler.php',\n               data: 'mode=show&table=Agent&agentid=" . $agent->getagentid() . "',\n               dataType : 'html',\n               success: function(data){\n                  \$('#agentDetailDiv" . $agent->getagentid() . "').html(data);\n               },\n               error: function( xhr, status, errorThrown ) {\n                  \$('#statusDiv').html('Error. ' + errorThrown);\n                  console.log( 'Error: ' + errorThrown );\n                  console.log( 'Status: ' + status );\n                  console.dir( xhr );\n               }\n            });\n            return false; \n        });\n        \$('#createLink').click(function () {\n            \$.ajax({\n               type: 'GET',\n               url: '{$clientRoot}/agents/rpc/handler.php',\n               data: 'mode=create&table=Agent',\n               dataType : 'html',\n               success: function(data){\n                  \$('#agentDetailDiv" . $agent->getagentid() . "').html(data);\n               },\n               error: function( xhr, status, errorThrown ) {\n                  \$('#statusDiv').html('Error. ' + errorThrown);\n                  console.log( 'Error: ' + errorThrown );\n                  console.log( 'Status: ' + status );\n                  console.dir( xhr );\n               }\n            });\n            return false; \n        });\n     </script>\n     ";
    }
    echo "<div id='agentDetailDiv" . $agent->getagentid() . "'>";
    echo $agentview->getDetailsView();
    echo "</div>";
    if ($findobjects == 1) {
        echo $am->getPrettyListOfCollectionObjectsForCollector($agent->getagentid());
    }
    footer();
}
/**
 * Return the requested agent as RDF in a turtle serialization.
 */
function deliverTurtle()
Esempio n. 2
0
function deleteAgentTeams($agentteamid = NULL)
{
    global $clientRoot;
    $result = "";
    $am = new AgentManager();
    if ($am->isAgentEditor()) {
        if (strlen($agentteamid) > 0) {
            $toDelete = new agentteams();
            $toDelete->setagentteamid($agentteamid);
            if ($toDelete->delete()) {
                $result = "Deleted.";
            } else {
                $result = "Error in deleting agent team record. " . $toDelete->errorMessage();
            }
        } else {
            $result = "No agent teams specified to delete.";
        }
    } else {
        $result = "You aren't authorized to edit agent records.";
    }
    return $result;
}