mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
- Migrating from SibusQL to OQL...
SVN:code[20]
This commit is contained in:
@@ -87,9 +87,9 @@ switch($operation)
|
||||
$sGroupBy = utils::ReadParam('group_by', '');
|
||||
if ($sFilter != '')
|
||||
{
|
||||
if ($sEncoding == 'sibusql')
|
||||
if ($sEncoding == 'oql')
|
||||
{
|
||||
$oFilter = CMDBSearchFilter::FromSibusQL($sFilter);
|
||||
$oFilter = CMDBSearchFilter::FromOQL($sFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -109,9 +109,9 @@ switch($operation)
|
||||
$aParams = utils::ReadParam('params', array());
|
||||
if ($sFilter != '')
|
||||
{
|
||||
if ($sEncoding == 'sibusql')
|
||||
if ($sEncoding == 'oql')
|
||||
{
|
||||
$oFilter = CMDBSearchFilter::FromSibusQL($sFilter);
|
||||
$oFilter = CMDBSearchFilter::FromOQL($sFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,32 +22,41 @@ $oP = null;
|
||||
|
||||
if (!empty($sExpression))
|
||||
{
|
||||
$oFilter = DBObjectSearch::FromSibusQL($sExpression);
|
||||
if ($oFilter)
|
||||
try
|
||||
{
|
||||
$oSet = new CMDBObjectSet($oFilter);
|
||||
switch($sFormat)
|
||||
$oFilter = DBObjectSearch::FromOQL($sExpression);
|
||||
if ($oFilter)
|
||||
{
|
||||
case 'html':
|
||||
$oP = new web_page("iTop - Export");
|
||||
cmdbAbstractObject::DisplaySet($oP, $oSet);
|
||||
break;
|
||||
|
||||
case 'csv':
|
||||
$oP = new CSVPage("iTop - Export");
|
||||
cmdbAbstractObject::DisplaySetAsCSV($oP, $oSet);
|
||||
break;
|
||||
|
||||
case 'xml':
|
||||
$oP = new XMLPage("iTop - Export");
|
||||
cmdbAbstractObject::DisplaySetAsXML($oP, $oSet);
|
||||
break;
|
||||
|
||||
default:
|
||||
$oP = new web_page("iTop - Export");
|
||||
$oP->add("Unsupported format '$sFormat'. Possible values are: html, csv or xml.");
|
||||
$oSet = new CMDBObjectSet($oFilter);
|
||||
switch($sFormat)
|
||||
{
|
||||
case 'html':
|
||||
$oP = new web_page("iTop - Export");
|
||||
cmdbAbstractObject::DisplaySet($oP, $oSet);
|
||||
break;
|
||||
|
||||
case 'csv':
|
||||
$oP = new CSVPage("iTop - Export");
|
||||
cmdbAbstractObject::DisplaySetAsCSV($oP, $oSet);
|
||||
break;
|
||||
|
||||
case 'xml':
|
||||
$oP = new XMLPage("iTop - Export");
|
||||
cmdbAbstractObject::DisplaySetAsXML($oP, $oSet);
|
||||
break;
|
||||
|
||||
default:
|
||||
$oP = new web_page("iTop - Export");
|
||||
$oP->add("Unsupported format '$sFormat'. Possible values are: html, csv or xml.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$oP = new web_page("iTop - Export");
|
||||
$oP->p("Error the query can not be executed.");
|
||||
$oP->p($e->GetHtmlDesc());
|
||||
}
|
||||
}
|
||||
if (!$oP)
|
||||
{
|
||||
@@ -55,7 +64,7 @@ if (!$oP)
|
||||
$oP = new web_page("iTop - Export");
|
||||
$oP->p("<strong>General purpose export page.</strong>");
|
||||
$oP->p("<strong>Parameters:</strong>");
|
||||
$oP->p("<ul><li>expression: a SibusQL expression</li>
|
||||
$oP->p("<ul><li>expression: an OQL expression (URL encoded if needed)</li>
|
||||
<li>format: (optional, default is html) the desired output format. Can be one of 'html', 'csv' or 'xml'</li>
|
||||
</ul>");
|
||||
}
|
||||
|
||||
@@ -17,15 +17,15 @@ $oP = new iTopWebPage("iTop - Expression Evaluation", $currentOrganization);
|
||||
|
||||
// Main program
|
||||
$sExpression = utils::ReadParam('expression', '');
|
||||
$sEncoding = utils::ReadParam('encoding', 'sibusql');
|
||||
$sEncoding = utils::ReadParam('encoding', 'oql');
|
||||
|
||||
if ($sEncoding == 'crypted')
|
||||
{
|
||||
// Translate $sExpression into a sibusql expression
|
||||
// Translate $sExpression into a oql expression
|
||||
$sClearText = base64_decode($sExpression);
|
||||
echo "<strong>FYI: '$sClearText'</strong><br/>\n";
|
||||
$oFilter = DBObjectSearch::unserialize($sExpression);
|
||||
$sExpression = $oFilter->ToSibusQL();
|
||||
$sExpression = $oFilter->ToOQL();
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -35,16 +35,16 @@ else
|
||||
|
||||
$oP->add('<form method="get">'."\n");
|
||||
$oP->add('Expression to evaluate:<br/>'."\n");
|
||||
$oP->add('<textarea cols="50" rows="20" name="expression">'.$sExpression.'</textarea>'."<p> Example:<br/>bizPerson: name Contains 'A'</p>\n");
|
||||
$oP->add('<textarea cols="50" rows="20" name="expression">'.$sExpression.'</textarea>'."<p> Example:<br/>SELECT bizPerson AS B WHERE B.name LIKE '%A%'</p>\n");
|
||||
$oP->add('<input type="submit" value=" Evaluate ">'."\n");
|
||||
$oP->add('</form>'."\n");
|
||||
|
||||
if (!empty($sExpression))
|
||||
{
|
||||
$oFilter = DBObjectSearch::FromSibusQL($sExpression);
|
||||
$oFilter = DBObjectSearch::FromOQL($sExpression);
|
||||
if ($oFilter)
|
||||
{
|
||||
$oP->p('Query expression: '.$oFilter->ToSibusQL());
|
||||
$oP->p('Query expression: '.$oFilter->ToOQL());
|
||||
$oP->p('Serialized filter: '.$oFilter->serialize());
|
||||
|
||||
$oSet = new CMDBObjectSet($oFilter);
|
||||
|
||||
Reference in New Issue
Block a user