Пример #1
0
            throw new Exception('Syntax error in configuration file: <tt>' . $sNoise . '</tt>');
        }
    }
}
/////////////////////////////////////////////////////////////////////
// Main program
//
LoginWebPage::DoLogin(true);
// Check user rights and prompt if needed (must be admin)
//$sOperation = utils::ReadParam('operation', 'menu');
//$oAppContext = new ApplicationContext();
$oP = new iTopWebPage(Dict::S('config-edit-title'));
$oP->set_base(utils::GetAbsoluteUrlAppRoot() . 'pages/');
try {
    $sOperation = utils::ReadParam('operation', '');
    $oP->add("<h1>" . Dict::S('config-edit-title') . "</h1>");
    if (MetaModel::GetConfig()->Get('demo_mode')) {
        $oP->add("<div class=\"header_message message_info\">Sorry, iTop is in <b>demonstration mode</b>: the configuration file cannot be edited.</div>");
    } else {
        $oP->add_style(<<<EOF
textarea {
\t-webkit-box-sizing: border-box;
\t-moz-box-sizing: border-box;
\tbox-sizing: border-box;

\twidth: 100%;
\theight: 550px;
}
.current_line {
\tdisplay: none;
\tmargin-left: 20px;
Пример #2
0
 * Page to configuration the notifications (triggers and actions)
 *
 * @copyright   Copyright (C) 2013 Combodo SARL
 * @license     http://opensource.org/licenses/AGPL-3.0
 */
require_once '../approot.inc.php';
require_once APPROOT . '/application/application.inc.php';
require_once APPROOT . '/application/itopwebpage.class.inc.php';
require_once APPROOT . '/application/startup.inc.php';
require_once APPROOT . '/application/loginwebpage.class.inc.php';
LoginWebPage::DoLogin(true);
// Check user rights and prompt if needed (must be admin)
// Main program
//
$oP = new iTopWebPage(Dict::S('Menu:NotificationsMenu+'));
$oP->add('<div class="page_header" style="padding:0.5em;">');
$oP->add('<h1>' . dict::S('UI:NotificationsMenu:Title') . '</h1>');
$oP->add('</div>');
$oP->StartCollapsibleSection(Dict::S('UI:NotificationsMenu:Help'), true);
$oP->add('<div style="padding: 1em; font-size:10pt;background:#E8F3CF;margin-top: 0.25em;">');
$oP->add('<img src="../images/bell.png" style="margin-top: -60px; margin-right: 10px; float: right;">');
$oP->add(Dict::S('UI:NotificationsMenu:HelpContent'));
$oP->add('</div>');
$oP->add('');
$oP->add('');
$oP->EndCollapsibleSection();
$oP->add('<p>&nbsp;</p>');
$oP->AddTabContainer('Tabs_0');
$oP->SetCurrentTabContainer('Tabs_0');
$oP->SetCurrentTab(Dict::S('UI:NotificationsMenu:Triggers'));
$oP->add('<h2>' . Dict::S('UI:NotificationsMenu:AvailableTriggers') . '</h2>');
Пример #3
0
$oP->add_linked_script("../js/json.js");
$oP->add_linked_script("../js/forms-json-utils.js");
$oP->add_linked_script("../js/wizardhelper.js");
$oP->add_linked_script("../js/wizard.utils.js");
$oP->add_linked_script("../js/linkswidget.js");
$oP->add_linked_script("../js/extkeywidget.js");
$oP->add_linked_script("../js/jquery.blockUI.js");
// From now on the context is limited to the the selected organization ??
// Now render the content of the page
$sBaseClass = utils::ReadParam('baseClass', 'Organization', false, 'class');
$sClass = utils::ReadParam('class', $sBaseClass, false, 'class');
$sOQLClause = utils::ReadParam('oql_clause', '', false, 'raw_data');
$sFilter = utils::ReadParam('filter', '', false, 'raw_data');
$sOperation = utils::ReadParam('operation', '');
// First part: select the class to search for
$oP->add("<form>");
$oP->add(Dict::S('UI:UniversalSearch:LabelSelectTheClass') . "<select style=\"width: 150px;\" id=\"select_class\" name=\"baseClass\" onChange=\"this.form.submit();\">");
$aClassLabels = array();
foreach (MetaModel::GetClasses('bizmodel') as $sCurrentClass) {
    $aClassLabels[$sCurrentClass] = MetaModel::GetName($sCurrentClass);
}
asort($aClassLabels);
foreach ($aClassLabels as $sCurrentClass => $sLabel) {
    $sDescription = MetaModel::GetClassDescription($sCurrentClass);
    $sSelected = $sCurrentClass == $sBaseClass ? " SELECTED" : "";
    $oP->add("<option value=\"{$sCurrentClass}\" title=\"{$sDescription}\"{$sSelected}>{$sLabel}</option>");
}
$oP->add("</select>\n");
$oP->add($oAppContext->GetForForm());
$oP->add("</form>\n");
try {
Пример #4
0
$sClass = utils::ReadParam('class', '');
$id = utils::ReadParam('id', 0);
$sRelation = utils::ReadParam('relation', 'neighbours');
try {
    $width = 1000;
    $height = 700;
    $sDrillUrl = urlencode(utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?operation=details');
    //	$sParams = "pWidth=$width&pHeight=$height&drillUrl=".urlencode('../pages/UI.php?operation=details')."&displayController=false&xmlUrl=".urlencode("./xml.navigator.php")."&obj_class=$sClass&obj_id=$id&relation=$sRelation";
    //	$oP->add("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"$width\" height=\"$height\" id=\"navigator\" align=\"middle\">
    //	<param name=\"allowScriptAccess\" value=\"sameDomain\" />
    //	<param name=\"allowFullScreen\" value=\"false\" />
    //	<param name=\"FlashVars\" value=\"$sParams\" />
    //	<param name=\"movie\" value=\"../images/navigator.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />
    //	<embed src=\"../images/navigator.swf\" flashVars=\"$sParams\" quality=\"high\" bgcolor=\"#ffffff\" width=\"$width\" height=\"$height\" name=\"navigator\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" />
    //	</object>\n");
    $oP->add("<div id=\"navigator\">If the chart does not display, <a href=\"http://get.adobe.com/flash/\" target=\"_blank\">install Flash</a></div>\n");
    $oP->add_ready_script(<<<EOF
var iWidth = \$('.ui-layout-content').width();
var iHeight = \$('.ui-layout-content').height();
swfobject.embedSWF("../navigator/navigator.swf", "navigator", "100%", "100%","9.0.0", "expressInstall.swf",
\t\t\t\t   { pWidth: iWidth, pHeight: iHeight, drillUrl: '{$sDrillUrl}', displayController: false, obj_class: '{$sClass}', obj_id: {$id}, relation: '{$sRelation}'},
\t\t\t\t   {wmode: 'transparent'}
\t\t\t\t   );
EOF
);
} catch (CoreException $e) {
    $oP->p('<b>An error occured while running the query:</b>');
    $oP->p($e->getHtmlDesc());
} catch (Exception $e) {
    $oP->p('<b>An error occured while running the query:</b>');
    $oP->p($e->getMessage());
Пример #5
0
}
require_once APPROOT . 'application/application.inc.php';
require_once APPROOT . 'application/itopwebpage.class.inc.php';
require_once APPROOT . 'application/startup.inc.php';
require_once APPROOT . 'application/loginwebpage.class.inc.php';
/////////////////////////////////////////////////////////////////////
// Main program
//
LoginWebPage::DoLogin(true);
// Check user rights and prompt if needed (must be admin)
//$sOperation = utils::ReadParam('operation', 'menu');
//$oAppContext = new ApplicationContext();
$oP = new iTopWebPage(Dict::S('bkp-status-title'));
$oP->set_base(utils::GetAbsoluteUrlAppRoot() . 'pages/');
try {
    $oP->add("<h1>" . Dict::S('bkp-status-title') . "</h1>");
    if (MetaModel::GetConfig()->Get('demo_mode')) {
        $oP->add("<div class=\"header_message message_info\">iTop is in <b>demonstration mode</b>: the feature is disabled.</div>");
    }
    $sImgOk = '<img src="../images/validation_ok.png"> ';
    $sImgError = '<img src="../images/validation_error.png"> ';
    $oP->add("<fieldset>");
    $oP->add("<legend>" . Dict::S('bkp-status-checks') . "</legend>");
    // Availability of mysqldump
    //
    $sMySQLBinDir = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', '');
    $sMySQLBinDir = utils::ReadParam('mysql_bindir', $sMySQLBinDir, true);
    if (empty($sMySQLBinDir)) {
        $sMySQLDump = 'mysqldump';
    } else {
        //echo 'Info - Found mysql_bindir: '.$sMySQLBinDir;
 /**
  * Display the details of an import
  */
 static function DisplayImportHistoryDetails(iTopWebPage $oPage, $iChange)
 {
     if ($iChange == 0) {
         throw new Exception("Missing parameter changeid");
     }
     $oChange = MetaModel::GetObject('CMDBChange', $iChange, false);
     if (is_null($oChange)) {
         throw new Exception("Unknown change: {$iChange}");
     }
     $oPage->add("<div><p><h1>" . Dict::Format('UI:History:BulkImportDetails', $oChange->Get('date'), $oChange->GetUserName()) . "</h1></p></div>\n");
     // Assumption : change made one single class of objects
     $aObjects = array();
     $aAttributes = array();
     // array of attcode => occurences
     $oOpSearch = DBObjectSearch::FromOQL("SELECT CMDBChangeOp WHERE change = :change_id");
     $oOpSet = new DBObjectSet($oOpSearch, array(), array('change_id' => $iChange));
     while ($oOperation = $oOpSet->Fetch()) {
         $sClass = $oOperation->Get('objclass');
         $iKey = $oOperation->Get('objkey');
         $iObjId = "{$sClass}::{$iKey}";
         if (!isset($aObjects[$iObjId])) {
             $aObjects[$iObjId] = array();
             $aObjects[$iObjId]['__class__'] = $sClass;
             $aObjects[$iObjId]['__id__'] = $iKey;
         }
         if (get_class($oOperation) == 'CMDBChangeOpCreate') {
             $aObjects[$iObjId]['__created__'] = true;
         } elseif ($oOperation instanceof CMDBChangeOpSetAttribute) {
             $sAttCode = $oOperation->Get('attcode');
             if (get_class($oOperation) == 'CMDBChangeOpSetAttributeScalar') {
                 $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
                 if ($oAttDef->IsExternalKey()) {
                     $sOldValue = Dict::S('UI:UndefinedObject');
                     if ($oOperation->Get('oldvalue') != 0) {
                         $oOldTarget = MetaModel::GetObject($oAttDef->GetTargetClass(), $oOperation->Get('oldvalue'));
                         $sOldValue = $oOldTarget->GetHyperlink();
                     }
                     $sNewValue = Dict::S('UI:UndefinedObject');
                     if ($oOperation->Get('newvalue') != 0) {
                         $oNewTarget = MetaModel::GetObject($oAttDef->GetTargetClass(), $oOperation->Get('newvalue'));
                         $sNewValue = $oNewTarget->GetHyperlink();
                     }
                 } else {
                     $sOldValue = $oOperation->GetAsHTML('oldvalue');
                     $sNewValue = $oOperation->GetAsHTML('newvalue');
                 }
                 $aObjects[$iObjId][$sAttCode] = $sOldValue . ' -&gt; ' . $sNewValue;
             } else {
                 $aObjects[$iObjId][$sAttCode] = 'n/a';
             }
             if (isset($aAttributes[$sAttCode])) {
                 $aAttributes[$sAttCode]++;
             } else {
                 $aAttributes[$sAttCode] = 1;
             }
         }
     }
     $aDetails = array();
     foreach ($aObjects as $iUId => $aObjData) {
         $aRow = array();
         $oObject = MetaModel::GetObject($aObjData['__class__'], $aObjData['__id__'], false);
         if (is_null($oObject)) {
             $aRow['object'] = $aObjData['__class__'] . '::' . $aObjData['__id__'] . ' (deleted)';
         } else {
             $aRow['object'] = $oObject->GetHyperlink();
         }
         if (isset($aObjData['__created__'])) {
             $aRow['operation'] = Dict::S('Change:ObjectCreated');
         } else {
             $aRow['operation'] = Dict::S('Change:ObjectModified');
         }
         foreach ($aAttributes as $sAttCode => $iOccurences) {
             if (isset($aObjData[$sAttCode])) {
                 $aRow[$sAttCode] = $aObjData[$sAttCode];
             } elseif (!is_null($oObject)) {
                 // This is the current vaslue: $oObject->GetAsHtml($sAttCode)
                 // whereas we are displaying the value that was set at the time
                 // the object was created
                 // This requires addtional coding...let's do that later
                 $aRow[$sAttCode] = '';
             } else {
                 $aRow[$sAttCode] = '';
             }
         }
         $aDetails[] = $aRow;
     }
     $aConfig = array();
     $aConfig['object'] = array('label' => MetaModel::GetName($sClass), 'description' => MetaModel::GetClassDescription($sClass));
     $aConfig['operation'] = array('label' => Dict::S('UI:History:Changes'), 'description' => Dict::S('UI:History:Changes+'));
     foreach ($aAttributes as $sAttCode => $iOccurences) {
         $aConfig[$sAttCode] = array('label' => MetaModel::GetLabel($sClass, $sAttCode), 'description' => MetaModel::GetDescription($sClass, $sAttCode));
     }
     $oPage->table($aConfig, $aDetails);
 }