|
@@ -537,23 +537,26 @@ try
|
|
|
|
|
|
case 'search_oql': // OQL query
|
|
|
$sOQLClass = utils::ReadParam('oql_class', '');
|
|
|
+ $sBaseClass = utils::ReadParam('base_class', $sOQLClass);
|
|
|
$sOQLClause = utils::ReadParam('oql_clause', '');
|
|
|
$sFormat = utils::ReadParam('format', '');
|
|
|
$bSearchForm = utils::ReadParam('search_form', true);
|
|
|
+ $sTitle = utils::ReadParam('title', 'UI:SearchResultsPageTitle');
|
|
|
if (empty($sOQLClass))
|
|
|
{
|
|
|
throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'oql_class'));
|
|
|
}
|
|
|
- $oP->set_title(Dict::S('UI:SearchResultsPageTitle'));
|
|
|
+ $oP->set_title(Dict::S($sTitle));
|
|
|
+ $oP->add('<h1>'.Dict::S($sTitle).'</h1>');
|
|
|
$sOQL = "SELECT $sOQLClass $sOQLClause";
|
|
|
try
|
|
|
{
|
|
|
- $oFilter = DBObjectSearch::FromOQL($sOQL);
|
|
|
- DisplaySearchSet($oP, $oFilter, $bSearchForm, $sBaseClass, $sFormat);
|
|
|
+ $oFilter = DBObjectSearch::FromOQL($sOQL);
|
|
|
+ DisplaySearchSet($oP, $oFilter, $bSearchForm, $sBaseClass, $sFormat);
|
|
|
}
|
|
|
catch(CoreException $e)
|
|
|
{
|
|
|
- $oFilter = new DBObjectSearch($sOQLClass);
|
|
|
+ $oFilter = new DBObjectSearch($sOQLClass);
|
|
|
$oSet = new DBObjectSet($oFilter);
|
|
|
if ($bSearchForm)
|
|
|
{
|
|
@@ -1366,7 +1369,7 @@ EOF
|
|
|
}
|
|
|
$oFilter = DBObjectSearch::unserialize($sFilter);
|
|
|
$sClass = $oFilter->GetClass();
|
|
|
- $aSelectObj = utils::ReadMultipleSelection($oFilter);
|
|
|
+ $aSelectObject = utils::ReadMultipleSelection($oFilter);
|
|
|
if (count($aSelectObject) == 0)
|
|
|
{
|
|
|
// Nothing to do, no object was selected !
|
|
@@ -1830,118 +1833,7 @@ EOF
|
|
|
break;
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
-
|
|
|
- case 'modify_links': // ?? still used ??
|
|
|
- $sClass = utils::ReadParam('class', '');
|
|
|
- $sLinkAttr = utils::ReadParam('link_attr', '');
|
|
|
- $sTargetClass = utils::ReadParam('target_class', '');
|
|
|
- $id = utils::ReadParam('id', '');
|
|
|
- $bAddObjects = utils::ReadParam('addObjects', false);
|
|
|
- if ( empty($sClass) || empty($id) || empty($sLinkAttr) || empty($sTargetClass)) // TO DO: check that the class name is valid !
|
|
|
- {
|
|
|
- throw new ApplicationException(Dict::Format('UI:Error:4ParametersMissing', 'class', 'id', 'target_class', 'link_attr'));
|
|
|
- }
|
|
|
- require_once(APPROOT.'/application/uilinkswizard.class.inc.php');
|
|
|
- $oWizard = new UILinksWizard($sClass, $sLinkAttr, $id, $sTargetClass);
|
|
|
- $oWizard->Display($oP, array('StartWithAdd' => $bAddObjects));
|
|
|
- break;
|
|
|
-
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
-
|
|
|
- case 'do_modify_links': // ?? still used ??
|
|
|
- $aLinks = utils::ReadPostedParam('linkId', array());
|
|
|
- $sLinksToRemove = trim(utils::ReadPostedParam('linksToRemove', ''));
|
|
|
- $aLinksToRemove = array();
|
|
|
- if (!empty($sLinksToRemove))
|
|
|
- {
|
|
|
- $aLinksToRemove = explode(' ', trim($sLinksToRemove));
|
|
|
- }
|
|
|
- $sClass = utils::ReadPostedParam('class', '');
|
|
|
- $sLinkageAtt = utils::ReadPostedParam('linkage', '');
|
|
|
- $iObjectId = utils::ReadPostedParam('object_id', '');
|
|
|
- $sLinkingAttCode = utils::ReadPostedParam('linking_attcode', '');
|
|
|
- $oMyChange = MetaModel::NewObject("CMDBChange");
|
|
|
- $oMyChange->Set("date", time());
|
|
|
- $sUserString = CMDBChange::GetCurrentUserName();
|
|
|
- $oMyChange->Set("userinfo", $sUserString);
|
|
|
- $iChangeId = $oMyChange->DBInsert();
|
|
|
-
|
|
|
- // Delete links that are to be deleted
|
|
|
- foreach($aLinksToRemove as $iLinkId)
|
|
|
- {
|
|
|
- if ($iLinkId > 0) // Negative IDs are objects that were not even created
|
|
|
- {
|
|
|
- $oLink = MetaModel::GetObject($sClass, $iLinkId);
|
|
|
- $oLink->DBDeleteTracked($oMyChange);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $aEditableFields = array();
|
|
|
- $aData = array();
|
|
|
- foreach(MetaModel::GetAttributesList($sClass) as $sAttCode)
|
|
|
- {
|
|
|
- $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
|
|
- if ( (!$oAttDef->IsExternalKey()) && (!$oAttDef->IsExternalField()))
|
|
|
- {
|
|
|
- $aEditableFields[] = $sAttCode;
|
|
|
- $aData[$sAttCode] = utils::ReadParam('attr_'.$sAttCode, array(), 'post');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // Update existing links or create new links
|
|
|
- foreach($aLinks as $iLinkId)
|
|
|
- {
|
|
|
- if ($iLinkId > 0)
|
|
|
- {
|
|
|
- // This is an existing link to be modified
|
|
|
- $oLink = MetaModel::GetObject($sClass, $iLinkId);
|
|
|
-
|
|
|
- // Update all the attributes of the link
|
|
|
- foreach($aEditableFields as $sAttCode)
|
|
|
- {
|
|
|
- $value = $aData[$sAttCode][$iLinkId];
|
|
|
- $oLink->Set($sAttCode, $value);
|
|
|
- }
|
|
|
- if ($oLink->IsModified())
|
|
|
- {
|
|
|
- $oLink->DBUpdateTracked($oMyChange);
|
|
|
- }
|
|
|
- //echo "Updated link:<br/>\n";
|
|
|
- //var_dump($oLink);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // A new link must be created
|
|
|
- $oLink = MetaModel::NewObject($sClass);
|
|
|
- $oLinkedObjectId = -$iLinkId;
|
|
|
- // Set all the attributes of the link
|
|
|
- foreach($aEditableFields as $sAttCode)
|
|
|
- {
|
|
|
- $value = $aData[$sAttCode][$iLinkId];
|
|
|
- $oLink->Set($sAttCode, $value);
|
|
|
- }
|
|
|
- // And the two external keys
|
|
|
- $oLink->Set($sLinkageAtt, $iObjectId);
|
|
|
- $oLink->Set($sLinkingAttCode, $oLinkedObjectId);
|
|
|
- // then save it
|
|
|
- //echo "Created link:<br/>\n";
|
|
|
- //var_dump($oLink);
|
|
|
- $oLink->DBInsertTracked($oMyChange);
|
|
|
- }
|
|
|
- }
|
|
|
- // Display again the details of the linked object
|
|
|
- $oAttDef = MetaModel::GetAttributeDef($sClass, $sLinkageAtt);
|
|
|
- $sTargetClass = $oAttDef->GetTargetClass();
|
|
|
- $oObj = MetaModel::GetObject($sTargetClass, $iObjectId);
|
|
|
-
|
|
|
- $oSearch = new DBObjectSearch(get_class($oObj));
|
|
|
- $oBlock = new DisplayBlock($oSearch, 'search', false);
|
|
|
- $oBlock->Display($oP, 0);
|
|
|
- $oObj->DisplayDetails($oP);
|
|
|
- break;
|
|
|
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
-
|
|
|
case 'swf_navigator': // Graphical display of the relations "impact" / "depends on"
|
|
|
$sClass = utils::ReadParam('class', '');
|
|
|
$id = utils::ReadParam('id', 0);
|