mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-20 16:34:11 +01:00
Compare commits
4 Commits
feature/fa
...
feature/at
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c2f923811 | ||
|
|
24b2852830 | ||
|
|
5ba44a03ea | ||
|
|
96382377ee |
@@ -181,6 +181,23 @@ abstract class AttributeDefinition
|
||||
return $this->GetSearchType() != static::SEARCH_WIDGET_TYPE_RAW;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsComputed()
|
||||
{
|
||||
return $this->IsParam('expression');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \OQLException
|
||||
*/
|
||||
protected function GetComputedPrerequisiteAttributes(): array {
|
||||
$oExpression = Expression::FromOQL($this->m_aParams['expression']);
|
||||
return $oExpression->ListRequiredFields();
|
||||
}
|
||||
|
||||
/** @var string */
|
||||
protected $m_sCode;
|
||||
/** @var array */
|
||||
@@ -2717,7 +2734,11 @@ class AttributeDBFieldVoid extends AttributeDefinition
|
||||
|
||||
public function GetPrerequisiteAttributes($sClass = null)
|
||||
{
|
||||
return $this->Get("depends_on");
|
||||
$aPrerequisiteAttributes = $this->Get("depends_on");
|
||||
if($this->IsComputed()) {
|
||||
$aPrerequisiteAttributes = array_merge($aPrerequisiteAttributes, $this->GetComputedPrerequisiteAttributes());
|
||||
}
|
||||
return $aPrerequisiteAttributes;
|
||||
}
|
||||
|
||||
public static function IsBasedOnDBColumns()
|
||||
@@ -2732,7 +2753,7 @@ class AttributeDBFieldVoid extends AttributeDefinition
|
||||
|
||||
public function IsWritable()
|
||||
{
|
||||
return !$this->IsMagic();
|
||||
return !$this->IsMagic() && !$this->IsComputed();
|
||||
}
|
||||
|
||||
public function GetSQLExpr()
|
||||
@@ -2962,14 +2983,12 @@ class AttributeInteger extends AttributeDBField
|
||||
|
||||
public function MakeRealValue($proposedValue, $oHostObj)
|
||||
{
|
||||
if (is_null($proposedValue))
|
||||
if (is_null($proposedValue) || $proposedValue === '')
|
||||
{
|
||||
return null;
|
||||
} elseif(gettype($proposedValue) !== 'integer') {
|
||||
IssueLog::Warning("Trying to set integer attribute ".$this->GetCode()." to type".gettype($proposedValue).".");
|
||||
}
|
||||
if ($proposedValue === '')
|
||||
{
|
||||
return null;
|
||||
} // 0 is transformed into '' !
|
||||
|
||||
return (int)$proposedValue;
|
||||
}
|
||||
|
||||
@@ -584,6 +584,14 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
],
|
||||
'cron_task_max_execution_time' => [
|
||||
'type' => 'integer',
|
||||
'description' => 'Background tasks will use this value (integer) multiplicated by its periodicity (in seconds) as max duration per cron execution. 0 is unlimited time',
|
||||
'default' => 0,
|
||||
'value' => 0,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'cron_sleep' => [
|
||||
'type' => 'integer',
|
||||
'description' => 'Duration (seconds) before cron.php checks again if something must be done',
|
||||
@@ -592,14 +600,6 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'cron.max_processes' => [
|
||||
'type' => 'integer',
|
||||
'description' => 'Maximum number of cron processes to run',
|
||||
'default' => 10,
|
||||
'value' => 10,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
],
|
||||
'async_task_retries' => [
|
||||
'type' => 'array',
|
||||
'description' => 'Automatic retries of asynchronous tasks in case of failure (per class)',
|
||||
|
||||
@@ -706,6 +706,8 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
$this->_Set($sAttCode, $realvalue);
|
||||
|
||||
$this->UpdateDependentComputedAttributes($sAttCode);
|
||||
|
||||
$this->UpdateMetaAttributes(array($sAttCode));
|
||||
|
||||
// The object has changed, reset caches
|
||||
@@ -6992,5 +6994,28 @@ abstract class DBObject implements iDisplay
|
||||
{
|
||||
return array_key_exists($sSection, $this->aContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sAttCode
|
||||
*
|
||||
* @return void
|
||||
* @throws CoreException
|
||||
* @throws OQLException
|
||||
* @throws Exception
|
||||
*/
|
||||
private function UpdateDependentComputedAttributes(string $sAttCode): void
|
||||
{
|
||||
foreach (MetaModel::GetDependentAttributes(get_class($this), $sAttCode) as $sCode) {
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sCode);
|
||||
if ($oAttDef->IsComputed()) {
|
||||
$oExpression = Expression::FromOQL($oAttDef->GetParams()['expression']);
|
||||
$value = $this->EvaluateExpression($oExpression);
|
||||
$aAllowedValues = $oAttDef->GetAllowedValues();
|
||||
if(is_null($aAllowedValues) || in_array($value, $aAllowedValues)) {
|
||||
$this->_Set($sCode, $oAttDef->MakeRealValue($value, $this));
|
||||
} ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2661,7 +2661,7 @@ abstract class MetaModel
|
||||
*/
|
||||
public static function GetAttributeFlags($sClass, $sState, $sAttCode)
|
||||
{
|
||||
$iFlags = 0; // By default (if no life cycle) no flag at all
|
||||
$iFlags = 0;
|
||||
if (self::HasLifecycle($sClass)) {
|
||||
$aStates = MetaModel::EnumStates($sClass);
|
||||
if (!array_key_exists($sState, $aStates)) {
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array(
|
||||
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
|
||||
'Brick:Portal:Object:Name' => 'Objekt',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Nový %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Aktualizace %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Aktualizace %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Vyplňte prosím následující informace:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Uloženo',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s uloženo',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Vybrat %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Vybrat %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Vybrat %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Vybrat %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%1$s: %2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Zkopíruj odkaz na objekt',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Zkopírováno'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array(
|
||||
Dict::Add('DA DA', 'Danish', 'Dansk', array(
|
||||
'Brick:Portal:Object:Name' => 'Object~~',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %1$s~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s~~',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Please, complete the following information:~~',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Saved~~',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s saved~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array(
|
||||
Dict::Add('DE DE', 'German', 'Deutsch', array(
|
||||
'Brick:Portal:Object:Name' => 'Object',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Neue %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Wird aktualisiert %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Wird aktualisiert %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Bitte folgende Informationen eintragen:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'gespeichert',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s gespeichert',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Objektverknüpfung kopieren',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Kopiert'
|
||||
|
||||
@@ -129,13 +129,13 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
Dict::Add('EN US', 'English', 'English', array(
|
||||
'Brick:Portal:Object:Name' => 'Object',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'New %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Please, complete the following information:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Saved',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s saved',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied'
|
||||
|
||||
@@ -116,13 +116,13 @@ Dict::Add('EN GB', 'British English', 'British English', array(
|
||||
Dict::Add('EN GB', 'British English', 'British English', array(
|
||||
'Brick:Portal:Object:Name' => 'Object',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'New %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Please, complete the following information:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Saved',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s saved',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied'
|
||||
|
||||
@@ -118,13 +118,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
|
||||
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
|
||||
'Brick:Portal:Object:Name' => 'Objecto',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Nuevo %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Actualizando %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Actualizando %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Por favor, proporcione la siguiente información:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Guardado',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s guardado',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Selección %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selección %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Selección %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selección %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copiar liga al objeto',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copiado'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'Brick:Portal:Object:Name' => 'Objet',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Création de %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Modification de %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Modification de %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Veuillez compléter les informations suivantes :',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Enregistré',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s enregistré(e)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Sélection de %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Sélection de %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Sélection de %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Sélection de %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copier l\'url de l\'objet',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copié'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'Brick:Portal:Object:Name' => 'Objektum',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Új %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => '%2$s frissítése (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => '%1$s frissítése',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Adja meg a következő információkat:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Mentve',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s mentve',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => '%1$s kiválasztása (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => '%1$s kiválasztása (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => '%1$s kiválasztása',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => '%1$s kiválasztása',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Objektum hivatkozás másolása',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Másolva'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array(
|
||||
Dict::Add('IT IT', 'Italian', 'Italiano', array(
|
||||
'Brick:Portal:Object:Name' => 'Object~~',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %1$s~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s~~',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Please, complete the following information:~~',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Saved~~',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s saved~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array(
|
||||
Dict::Add('JA JP', 'Japanese', '日本語', array(
|
||||
'Brick:Portal:Object:Name' => 'Object~~',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %1$s~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s~~',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Please, complete the following information:~~',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Saved~~',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s saved~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~'
|
||||
|
||||
@@ -121,13 +121,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
|
||||
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
|
||||
'Brick:Portal:Object:Name' => 'Object',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Nieuw %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Verwerken %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Verwerken %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Vul de volgende informatie in:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Opgeslagen',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s opgeslagen',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Geselecteerd %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selecteer %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Geselecteerd %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selecteer %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Kopieer link naar object',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Gekopieerd'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array(
|
||||
Dict::Add('PL PL', 'Polish', 'Polski', array(
|
||||
'Brick:Portal:Object:Name' => 'Obiekty',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Nowy %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Aktualizacja %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Aktualizacja %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Prosimy o uzupełnienie poniższych informacji:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Zapisany',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s zapisany',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Wybierz %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Wybierz %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Wybierz %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Wybierz %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Skopiuj obiekt',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Skopiowano'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Brick:Portal:Object:Name' => 'Objeto',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Novo %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Alterar %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Alterar %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Por favor, preencha as seguintes informações:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Salvo',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s salvo',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Selecionar %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selecinar %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Selecionar %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selecionar %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copiar',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copiado'
|
||||
|
||||
@@ -121,13 +121,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array(
|
||||
Dict::Add('RU RU', 'Russian', 'Русский', array(
|
||||
'Brick:Portal:Object:Name' => 'Object',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'Создать %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Обновление %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s : %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Обновление %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Пожалуйста, укажите следующую информацию:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Сохранено',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s сохранено',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Выбрать %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Выбрать %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Выбрать %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Выбрать %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Скопировать ссылку на объект',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Ссылка скопирована'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
|
||||
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
|
||||
'Brick:Portal:Object:Name' => 'Object~~',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %1$s~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s~~',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Please, complete the following information:~~',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Saved~~',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s saved~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~'
|
||||
|
||||
@@ -120,13 +120,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
|
||||
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
|
||||
'Brick:Portal:Object:Name' => 'Object~~',
|
||||
'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s~~',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => 'Updating %1$s~~',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s~~',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => 'Please, complete the following information:~~',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => 'Saved~~',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '%1$s saved~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s~~',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~'
|
||||
|
||||
@@ -129,13 +129,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array(
|
||||
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
|
||||
'Brick:Portal:Object:Name' => '对象',
|
||||
'Brick:Portal:Object:Form:Create:Title' => '新建 %1$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => '正在更新 %2$s (%1$s)',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s: %2$s',
|
||||
'Brick:Portal:Object:Form:Edit:Title' => '正在更新 %1$s',
|
||||
'Brick:Portal:Object:Form:View:Title' => '%1$s',
|
||||
'Brick:Portal:Object:Form:Stimulus:Title' => '请填写下列信息:',
|
||||
'Brick:Portal:Object:Form:Message:Saved' => '已保存',
|
||||
'Brick:Portal:Object:Form:Message:ObjectSaved' => '已保存 %1$s',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => '选择 %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => '选择 %1$s (%2$s)',
|
||||
'Brick:Portal:Object:Search:Regular:Title' => '选择 %1$s',
|
||||
'Brick:Portal:Object:Search:Hierarchy:Title' => '选择 %1$s',
|
||||
'Brick:Portal:Object:Copy:TextToCopy' => '%2$s',
|
||||
'Brick:Portal:Object:Copy:Tooltip' => '复制对象链接',
|
||||
'Brick:Portal:Object:Copy:CopiedTooltip' => '已复制'
|
||||
|
||||
@@ -118,6 +118,10 @@ services:
|
||||
combodo.current_user:
|
||||
alias: Combodo\iTop\Portal\Twig\CurrentUserAccessor
|
||||
public: true
|
||||
|
||||
combodo.app_icon_url:
|
||||
alias: Combodo\iTop\Portal\Twig\AppIconUrlAccessor
|
||||
public: true
|
||||
|
||||
# Aliases
|
||||
brick_collection:
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -26,6 +26,7 @@ ipb-dropdown {
|
||||
background-color: $ipb-dropdown--li--background-color;
|
||||
a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
padding: $ipb-dropdown--a--padding-y $ipb-dropdown--a--padding-x;
|
||||
border-radius: $ipb-dropdown--a--border-radius;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -7,6 +7,15 @@ $ipb--fieldset--border-radius: $common-border-radius-500 !default;
|
||||
$ipb--fieldset--legend--padding-y: $common-spacing-0 !default;
|
||||
$ipb--fieldset--legend--padding-x: 13px !default;
|
||||
|
||||
$ipb-field--has-tooltip-or-is-mandatory--vertical-align: top !default;
|
||||
$ipb-field--has-tooltip-or-is-mandatory--left: $common-spacing-200 !default;
|
||||
|
||||
$ipb-field--has-tooltip--content: "\f05a" !default;
|
||||
$ipb-field--has-tooltip--color: $common-color-grey-700 !default;
|
||||
|
||||
$ipb-field--is-mandatory--content: "\f069" !default;
|
||||
$ipb-field--is-mandatory--color: $common-color-orange-700 !default;
|
||||
$ipb-field--is-mandatory--font-size: 0.6rem !default;
|
||||
|
||||
.form_fields {
|
||||
fieldset {
|
||||
@@ -18,4 +27,25 @@ $ipb--fieldset--legend--padding-x: 13px !default;
|
||||
padding: $ipb--fieldset--legend--padding-y $ipb--fieldset--legend--padding-x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.form_field_label > .control-label[data-tooltip-instantiated="true"]:after, .form_field .form_mandatory .control-label:after {
|
||||
position: relative;
|
||||
vertical-align: $ipb-field--has-tooltip-or-is-mandatory--vertical-align;
|
||||
left: $ipb-field--has-tooltip-or-is-mandatory--left;
|
||||
@extend %fa-solid-base;
|
||||
}
|
||||
|
||||
.form_field_label > .control-label[data-tooltip-instantiated="true"]:after {
|
||||
content: $ipb-field--has-tooltip--content;
|
||||
color: $ipb-field--has-tooltip--color;
|
||||
cursor: pointer;
|
||||
@extend %common-font-size-50;
|
||||
}
|
||||
|
||||
.form_field .form_mandatory .control-label:after{
|
||||
content: $ipb-field--is-mandatory--content;
|
||||
color: $ipb-field--is-mandatory--color;
|
||||
font-size: $common-font-size-20;
|
||||
};
|
||||
@@ -6,80 +6,91 @@
|
||||
/* SCSS variables */
|
||||
$ipb-modal--max-height: 90vh !default;
|
||||
$ipb-modal--max-width: 90vw !default;
|
||||
$ipb-modal--border-radius: $common-border-radius-500 !default;
|
||||
|
||||
$ipb-modal--extra-small--relative-height: 20vh !default;
|
||||
$ipb-modal--extra-small--absolute-height: 150px !default;
|
||||
$ipb-modal--extra-small--height: calc(min(#{$ipb-modal--extra-small--relative-height}, #{$ipb-modal--extra-small--absolute-height})) !default;
|
||||
$ipb-modal--extra-small--relative-width: 20vw !default;
|
||||
$ipb-modal--extra-small--absolute-width: 200px !default;
|
||||
$ipb-modal--extra-small--width: calc(min(#{$ipb-modal--extra-small--relative-width}, #{$ipb-modal--extra-small--absolute-width})) !default;
|
||||
$ipb-modal--header--background-color: $common-color-white-100 !default;
|
||||
$ipb-modal--header--color: $common-color-grey-900 !default;
|
||||
$ipb-modal--header--border-radius: $ipb-modal--border-radius $ipb-modal--border-radius 0 0 !default;
|
||||
|
||||
$ipb-modal--small--relative-height: 60vh !default;
|
||||
$ipb-modal--small--absolute-height: 400px !default;
|
||||
$ipb-modal--small--height: calc(min(#{$ipb-modal--small--relative-height}, #{$ipb-modal--small--absolute-height})) !default;
|
||||
$ipb-modal--small--relative-width: 60vw !default;
|
||||
$ipb-modal--small--absolute-width: 800px !default;
|
||||
$ipb-modal--small--width: calc(min(#{$ipb-modal--small--relative-width}, #{$ipb-modal--small--absolute-width})) !default;
|
||||
$ipb-modal--header--close--color: $common-color-grey-900 !default;
|
||||
$ipb-modal--header--close--opacity: 1 !default;
|
||||
$ipb-modal--header--close--hover--color: $common-color-grey-700 !default;
|
||||
|
||||
$ipb-modal--medium--relative-height: 75vh !default;
|
||||
$ipb-modal--medium--absolute-height: 600px !default;
|
||||
$ipb-modal--medium--height: calc(min(#{$ipb-modal--medium--relative-height}, #{$ipb-modal--medium--absolute-height})) !default;
|
||||
$ipb-modal--medium--relative-width: 75vw !default;
|
||||
$ipb-modal--medium--absolute-width: 1200px !default;
|
||||
$ipb-modal--medium--width: calc(min(#{$ipb-modal--medium--relative-width}, #{$ipb-modal--medium--absolute-width})) !default;
|
||||
$ipb-modal--backdrop--opacity: 0.6 !default;
|
||||
$ipb-modal--backdrop--background-color: $common-color-blue-grey-800 !default;
|
||||
$ipb-modal--backdrop--backdrop-filter: blur(2px) !default;
|
||||
|
||||
$ipb-modal--large--relative-height: 90vh !default;
|
||||
$ipb-modal--large--absolute-height: 900px !default;
|
||||
$ipb-modal--large--height: calc(min(#{$ipb-modal--large--relative-height}, #{$ipb-modal--large--absolute-height})) !default;
|
||||
$ipb-modal--large--relative-width: 90vw !default;
|
||||
$ipb-modal--large--absolute-width: 1800px !default;
|
||||
$ipb-modal--large--width: calc(min(#{$ipb-modal--large--relative-width}, #{$ipb-modal--large--absolute-width})) !default;
|
||||
$ipb-modal--content--border-radius: $ipb-modal--border-radius !default;
|
||||
$ipb-modal--content--border: 1px solid $common-color-grey-400 !default;
|
||||
|
||||
$ipb-modal--title--color: $ipb-modal--header--color !default;
|
||||
$ipb-modal--title--to-clipboard--margin: $common-spacing-200 !default;
|
||||
$ipb-modal--title--span--margin-left: 5px !default;
|
||||
$ipb-modal--title--span--separator--margin-right: $common-spacing-200 !default;
|
||||
$ipb-modal--title--span--separator--width: $common-size-100 !default;
|
||||
$ipb-modal--title--span--separator--height: $ipb-modal--title--span--separator--width !default;
|
||||
$ipb-modal--title--span--separator--border-radius: $common-border-radius-full !default;
|
||||
$ipb-modal--title--span--separator--background-color: $common-color-grey-800 !default;
|
||||
|
||||
$ipb-modal-option--do-not-show-again--margin-top: $common-spacing-500 !default;
|
||||
|
||||
$ipb-modal--is-informative--min-width: $common-size-700 !default;
|
||||
$ipb-modal--is-informative--min-height: $common-size-300 !default;
|
||||
$ipb-modal--is-informative--is-error--highlight--background-color: $common-color-red-600 !default;
|
||||
$ipb-modal--is-informative--is-warning--highlight--background-color: $common-color-orange-600 !default;
|
||||
$ipb-modal--is-informative--is-information--highlight--background-color: $common-color-blue-600 !default;
|
||||
$ipb-modal--is-informative--is-success--highlight--background-color: $common-color-green-600 !default;
|
||||
|
||||
/* Avoid modals bigger than window size
|
||||
!important in order to overload jQueryUI max-height:none being put on dialog elements */
|
||||
.modal .modal-dialog{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: $ipb-modal--max-height !important;
|
||||
max-width: $ipb-modal--max-width !important;
|
||||
border-radius: 5px;
|
||||
border-radius: $ipb-modal--border-radius;
|
||||
.modal-header {
|
||||
background-color: white;
|
||||
color: #232323;
|
||||
background-color: $ipb-modal--header--background-color;
|
||||
color: $ipb-modal--header--color;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-backdrop.in {
|
||||
opacity: .6;
|
||||
background-color: $common-color-blue-grey-800;
|
||||
backdrop-filter: blur(2px);
|
||||
opacity: $ipb-modal--backdrop--opacity;
|
||||
background-color: $ipb-modal--backdrop--background-color;
|
||||
backdrop-filter: $ipb-modal--backdrop--backdrop-filter;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
border-radius: 5px !important;
|
||||
border: 1px solid $common-color-grey-400;
|
||||
border-radius: $ipb-modal--content--border-radius !important;
|
||||
border: $ipb-modal--content--border;
|
||||
box-shadow: none !important;
|
||||
-webkit-box-shadow: none !important;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
border-radius: 5px 5px 0 0 !important;
|
||||
border-radius:$ipb-modal--header--border-radius !important;
|
||||
.close {
|
||||
color: $ipb-modal--header--close--color;
|
||||
opacity: $ipb-modal--header--close--opacity;
|
||||
|
||||
@extend %common-font-size-400;
|
||||
&:hover {
|
||||
color: $ipb-modal--header--close--hover--color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
color: #232323 !important;
|
||||
color: $ipb-modal--title--color !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span ~ span {
|
||||
margin-left: $ipb-modal--title--span--margin-left;
|
||||
&:before {
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-right: $ipb-modal--title--span--separator--margin-right;
|
||||
width: $ipb-modal--title--span--separator--width;
|
||||
height: $ipb-modal--title--span--separator--height;
|
||||
border-radius: $ipb-modal--title--span--separator--border-radius;
|
||||
background-color: $ipb-modal--title--span--separator--background-color;
|
||||
}
|
||||
}
|
||||
.url-to-clipboard.url-to-clipboard-icon {
|
||||
margin-right: 4px;
|
||||
margin-right: $ipb-modal--title--to-clipboard--margin;
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,8 @@ $ipb-panel--border-radius: $common-border-radius-300!default;
|
||||
border-radius: 0 $common-border-radius-500 $common-border-radius-500 $common-border-radius-500;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
@extend %common-font-ral-med-200;
|
||||
}
|
||||
@@ -136,6 +136,8 @@ $ipb-tile--description--color: $common-base-variable--text-color !default;
|
||||
.ipb-tile--extra-content {
|
||||
flex-grow: 1;
|
||||
position: relative;
|
||||
|
||||
@extend %common-font-ral-nor-150;
|
||||
}
|
||||
|
||||
/****************************/
|
||||
|
||||
@@ -50,7 +50,7 @@ body{
|
||||
font-weight: bold;
|
||||
color: $ipb-page--main-header--information--title--color;
|
||||
|
||||
> span:nth-child(2) {
|
||||
> span ~ span {
|
||||
@include ipb-following-dot;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1,3 @@
|
||||
@import "browse-brick";
|
||||
@import "manage-brick";
|
||||
@import "manage-brick";
|
||||
@import "object-brick";
|
||||
@@ -10,9 +10,10 @@ $ipb-browse-brick--mosaic-breadcrumb--padding: $common-spacing-200 !default;
|
||||
$ipb-browse-brick--mosaic-breadcrumb--active--color: $common-color-grey-800 !default;
|
||||
$ipb-browse-brick--mosaic-breadcrumb--a--color: $common-color-primary-800 !default;
|
||||
|
||||
$ipb-browse-brick--mosaic--small--grid-template-columns: 100% !default;
|
||||
$ipb-browse-brick--mosaic--medium--grid-template-columns: 50% 50% !default;
|
||||
$ipb-browse-brick--mosaic--large--grid-template-columns: 33.3% 33.3% 33.3% !default;
|
||||
$ipb-browse-brick--mosaic--gap: $common-spacing-300 !default;
|
||||
$ipb-browse-brick--mosaic--small--grid-template-columns: 1fr !default;
|
||||
$ipb-browse-brick--mosaic--medium--grid-template-columns: repeat(2, 1fr) !default;
|
||||
$ipb-browse-brick--mosaic--large--grid-template-columns: repeat(3, 1fr) !default;
|
||||
|
||||
|
||||
$ipb-browse-brick--mosaic-group-item--min-height: $common-size-550 !default;
|
||||
@@ -21,17 +22,20 @@ $ipb-browse-brick--mosaic-group-item--width: 100% !default;
|
||||
$ipb-browse-brick--mosaic-group-item--margin: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--mosaic-group-item--color: $common-base-variable--text-color !default;
|
||||
$ipb-browse-brick--mosaic-group-item--border: 1px solid $common-color-grey-300 !default;
|
||||
$ipb-browse-brick--mosaic-group-item--border-radius: $common-border-radius-300 !default;
|
||||
$ipb-browse-brick--mosaic-group-item--background-color: $common-color-white-100 !default;
|
||||
$ipb-browse-brick--mosaic-group-item--animation--transform-x: -20px !default;
|
||||
|
||||
$ipb-browse-brick--mosaic-group-item--actions--top: $common-spacing-500 !default;
|
||||
$ipb-browse-brick--mosaic-group-item--actions--right: $common-spacing-500 !default;
|
||||
$ipb-browse-brick--mosaic-item--height: 100% !default;
|
||||
$ipb-browse-brick--mosaic-item--padding: $common-spacing-500 !default;
|
||||
$ipb-browse-brick--mosaic-item--padding: $common-spacing-600 !default;
|
||||
$ipb-browse-brick--mosaic-item--margin: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--mosaic-item--border-radius: $ipb-browse-brick--mosaic-group-item--border-radius !default;
|
||||
$ipb-browse-brick--mosaic-item--background-color: $common-color-white-100 !default;
|
||||
$ipb-browse-brick--mosaic-item--color: $common-base-variable--text-color !default;
|
||||
$ipb-browse-brick--mosaic-item--hover--background-color: $common-color-grey-200 !default;
|
||||
$ipb-browse-brick--mosaic-item--hover--color: $common-color-grey-800 !default;
|
||||
$ipb-browse-brick--mosaic-item--hover--color: inherit !default;
|
||||
$ipb-browse-brick--mosaic-item--hover--background-color--alpha: 0.05 !default;
|
||||
|
||||
$ipb-browse-brick--mosaic-item-description--color: $common-color-grey-800 !default;
|
||||
|
||||
@@ -41,12 +45,16 @@ $ipb-browse-brick--mosaic-item-image--border-radius: $common-border-radius-700 !
|
||||
$ipb-browse-brick--mosaic-item-image--padding: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--mosaic-item-image--margin-bottom: $common-spacing-500 !default;
|
||||
$ipb-browse-brick--mosaic-item-image--background-color: common-adjust-alpha($common-color-blue-700, .1) !default;
|
||||
$ipb-browse-brick--mosaic-item-image--background-color--alpha: 0.1 !default;
|
||||
$ipb-browse-brick--mosaic-item-image--color: $common-color-blue-700 !default;
|
||||
|
||||
$ipb-browse-brick--mosaic-item-image--img--height: $common-size-300 !default;
|
||||
|
||||
$ipb-browse-brick--mosaic-item-description--margin-top: $common-spacing-300 !default;
|
||||
|
||||
$ipb-browse-brick-panel--mosaic--background-color: transparent !default;
|
||||
$ipb-browse-brick-panel--mosaic--border: none !default;
|
||||
|
||||
$ipb-browse-brick-panel--dataTables_wrapper--padding-x: $common-spacing-0 !default;
|
||||
$ipb-browse-brick-panel--dataTables_wrapper--padding-y: $common-size-200 !default;
|
||||
$ipb-browse-brick-panel--dataTables_wrapper--row--div--padding-x: $common-size-200 !default;
|
||||
@@ -57,8 +65,10 @@ $ipb-browse-brick--tree-item--color: $common-color-grey-900 !default;
|
||||
$ipb-browse-brick--tree-item--hyperlink--color: $common-hyperlink-color !default;
|
||||
|
||||
|
||||
$ipb-browse-brick--tree-item-filter-data--color: $common-color-grey-500 !default;
|
||||
$ipb-browse-brick--tree-item-filter-data--padding-top: $common-spacing-300 !default;
|
||||
$ipb-browse-brick--tree-item-filter-data--color: $common-color-grey-800 !default;
|
||||
$ipb-browse-brick--tree-item-filter-data--margin-top: $common-spacing-300 !default;
|
||||
$ipb-browse-brick--tree-item-filter-data--item--margin-y: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--tree-item-filter-data--item--margin-x: $common-spacing-300 !default;
|
||||
|
||||
$ipb-browse-brick--tree-item--description--margin-top: $common-spacing-200 !default;
|
||||
$ipb-browse-brick--tree-item--description--color: $common-color-grey-800 !default;
|
||||
@@ -80,15 +90,19 @@ $ipb-browse-brick--tree-item-image--has-glyphicon--margin-right: $common-spacing
|
||||
$ipb-browse-brick--tree-item--has-glyphicon--description--margin-left: 19px !default;
|
||||
|
||||
|
||||
$ipb-browse-brick--list-group-item--padding-y: $common-spacing-400 !default;
|
||||
$ipb-browse-brick--list-group-item--padding-y: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--list-group-item--padding-x: $common-spacing-500 !default;
|
||||
$ipb-browse-brick--list-group-item--margin-bottom: -1px !default;
|
||||
$ipb-browse-brick--list-group-item--background-color: $common-color-white-100 !default;
|
||||
$ipb-browse-brick--list-group-item--border: 1px solid $common-color-grey-400 !default;
|
||||
|
||||
$ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--list-group--margin-bottom: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--list-group-item--tree-item-wrapper--padding-bottom: $common-spacing-500 !default;
|
||||
|
||||
|
||||
$ipb-browse-brick--list-group--tree--margin: $common-spacing-0 !default;
|
||||
$ipb-browse-brick--list-group--tree--background-color: $common-color-white-100 !default;
|
||||
|
||||
// Common
|
||||
.ipb-browse-brick-panel {
|
||||
.row {
|
||||
@@ -110,6 +124,10 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
}
|
||||
|
||||
// Mosaic view
|
||||
.page_browse_brick_as_mosaic .ipb-browse-brick-panel{
|
||||
background-color: $ipb-browse-brick-panel--mosaic--background-color !important;
|
||||
border: $ipb-browse-brick-panel--mosaic--border !important;
|
||||
}
|
||||
|
||||
#brick_content_mosaic{
|
||||
padding: $ipb-content-mosaic--padding;
|
||||
@@ -126,9 +144,10 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
|
||||
.mosaic-group {
|
||||
display: grid;
|
||||
animation: opacity 0.3s ease-out;
|
||||
transition: all 1s;
|
||||
animation-delay: 0.2s;
|
||||
|
||||
gap: $ipb-browse-brick--mosaic--gap;
|
||||
|
||||
@include touch {
|
||||
grid-template-columns: $ipb-browse-brick--mosaic--small--grid-template-columns;
|
||||
}
|
||||
@@ -155,67 +174,22 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
width: $ipb-browse-brick--mosaic-group-item--width;
|
||||
margin: $ipb-browse-brick--mosaic-group-item--margin;
|
||||
color: $ipb-browse-brick--mosaic-group-item--color;
|
||||
opacity: 0;
|
||||
transform: translateX($ipb-browse-brick--mosaic-group-item--animation--transform-x); /* Move from left */
|
||||
animation: mosaicGroupItemFadeInLeft 0.3s ease-out forwards;
|
||||
animation-delay: calc(var(--delay) * var(--index));
|
||||
|
||||
border: $ipb-browse-brick--mosaic-group-item--border;
|
||||
border-radius: $ipb-browse-brick--mosaic-group-item--border-radius;
|
||||
background-color: $ipb-browse-brick--mosaic-group-item--background-color;
|
||||
|
||||
@for $i from 1 through length($ipb-browse-brick--mosaic-item--highlight-color) {
|
||||
&:nth-child(#{length($ipb-browse-brick--mosaic-item--highlight-color)}n + #{$i}) .mosaic-item-image {
|
||||
background-color: common-adjust-alpha(nth($ipb-browse-brick--mosaic-item--highlight-color, $i), .1);
|
||||
color: nth($ipb-browse-brick--mosaic-item--highlight-color, $i);
|
||||
&:nth-child(#{length($ipb-browse-brick--mosaic-item--highlight-color)}n + #{$i}){
|
||||
.mosaic-item:hover{
|
||||
background-color: common-adjust-alpha(nth($ipb-browse-brick--mosaic-item--highlight-color, $i), $ipb-browse-brick--mosaic-item--hover--background-color--alpha);
|
||||
}
|
||||
.mosaic-item-image {
|
||||
background-color: common-adjust-alpha(nth($ipb-browse-brick--mosaic-item--highlight-color, $i), $ipb-browse-brick--mosaic-item-image--background-color--alpha);
|
||||
color: nth($ipb-browse-brick--mosaic-item--highlight-color, $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include touch {
|
||||
border-bottom: $ipb-browse-brick--mosaic-group-item--border;
|
||||
border-right: $ipb-browse-brick--mosaic-group-item--border;
|
||||
|
||||
border-right: none;
|
||||
&:last-child {
|
||||
border-bottom: none; // Remove bottom border from last element
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: could be cleaned up, but desktop to widescreen needs to not affect fullhd
|
||||
|
||||
@include desktop-only {
|
||||
border-bottom: $ipb-browse-brick--mosaic-group-item--border;
|
||||
border-right: $ipb-browse-brick--mosaic-group-item--border;
|
||||
|
||||
// Remove bottom border only from elements in the last row
|
||||
&:last-child, // Last element
|
||||
&:nth-last-child(2):nth-child(2n - 1) { // Second-last element if it's in the same row as last element
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
@include widescreen-only {
|
||||
border-bottom: $ipb-browse-brick--mosaic-group-item--border;
|
||||
border-right: $ipb-browse-brick--mosaic-group-item--border;
|
||||
|
||||
// Remove bottom border only from elements in the last row
|
||||
&:last-child, // Last element
|
||||
&:nth-last-child(2):nth-child(2n - 1) { // Second-last element if it's in the same row as last element
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
@include fullhd {
|
||||
border-bottom: $ipb-browse-brick--mosaic-group-item--border;
|
||||
border-right: $ipb-browse-brick--mosaic-group-item--border;
|
||||
|
||||
&:nth-child(3n) {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
// Remove bottom border from elements in the last row only
|
||||
&:last-child, // Last element
|
||||
&:nth-last-child(2):nth-child(3n - 1), // Second-last element if in same row as last
|
||||
&:nth-last-child(2):nth-child(3n - 2), // Second-last element if in same row as last
|
||||
&:nth-last-child(3):nth-child(3n - 2) { // Third-last element if in same row as last
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .mosaic-group-item-actions {
|
||||
position: absolute;
|
||||
@@ -224,16 +198,6 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes mosaicGroupItemFadeInLeft {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX($ipb-browse-brick--mosaic-group-item--animation--transform-x);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
.mosaic-item {
|
||||
display: flex;
|
||||
@@ -241,6 +205,7 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
height: $ipb-browse-brick--mosaic-item--height;
|
||||
padding: $ipb-browse-brick--mosaic-item--padding;
|
||||
margin: $ipb-browse-brick--mosaic-item--margin;
|
||||
border-radius: $ipb-browse-brick--mosaic-item--border-radius;
|
||||
|
||||
background-color: $ipb-browse-brick--mosaic-item--background-color;
|
||||
color: $ipb-browse-brick--mosaic-item--color;
|
||||
@@ -248,7 +213,6 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
|
||||
|
||||
&:hover {
|
||||
background-color: $ipb-browse-brick--mosaic-item--hover--background-color;
|
||||
color: $ipb-browse-brick--mosaic-item--hover--color;
|
||||
}
|
||||
}
|
||||
@@ -304,6 +268,9 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
}
|
||||
|
||||
// Tree view
|
||||
.tree-item {
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.list-group-item .list-group-item-text, .tree-item {
|
||||
color: $ipb-browse-brick--tree-item--color;
|
||||
@@ -324,8 +291,18 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
}
|
||||
|
||||
.list-group-item .tree-item-wrapper .tree-item-filter-data {
|
||||
padding-top: $ipb-browse-brick--tree-item-filter-data--padding-top;
|
||||
margin-top: $ipb-browse-brick--tree-item-filter-data--margin-top;
|
||||
color: $ipb-browse-brick--tree-item-filter-data--color;
|
||||
@extend %common-font-ral-med-100;
|
||||
|
||||
> span:not(:last-child):after {
|
||||
content: '●';
|
||||
margin: $ipb-browse-brick--tree-item-filter-data--item--margin-y $ipb-browse-brick--tree-item-filter-data--item--margin-x;
|
||||
}
|
||||
a {
|
||||
color: $ipb-browse-brick--tree-item-filter-data--color;
|
||||
font-size: $common-font-size-100 !important;
|
||||
}
|
||||
}
|
||||
|
||||
#brick_content_tree .list-group-item>.tree-item-wrapper {
|
||||
@@ -347,9 +324,14 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
|
||||
|
||||
@for $i from 1 through length($ipb-browse-brick--mosaic-item--highlight-color) {
|
||||
&:nth-child(#{length($ipb-browse-brick--mosaic-item--highlight-color)}n + #{$i - 1}) > .tree-item-wrapper .tree-item-image {
|
||||
background-color: common-adjust-alpha(nth($ipb-browse-brick--mosaic-item--highlight-color, $i), .1);
|
||||
color: nth($ipb-browse-brick--mosaic-item--highlight-color, $i);
|
||||
&:nth-child(#{length($ipb-browse-brick--mosaic-item--highlight-color)}n + #{$i - 1}) {
|
||||
&:hover {
|
||||
background-color: common-adjust-alpha(nth($ipb-browse-brick--mosaic-item--highlight-color, $i), $ipb-browse-brick--mosaic-item--hover--background-color--alpha);
|
||||
}
|
||||
> .tree-item-wrapper .tree-item-image {
|
||||
background-color: common-adjust-alpha(nth($ipb-browse-brick--mosaic-item--highlight-color, $i), $ipb-browse-brick--mosaic-item-image--background-color--alpha);
|
||||
color: nth($ipb-browse-brick--mosaic-item--highlight-color, $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,20 +370,14 @@ $ipb-browse-brick--list-group-margin-bottom: $common-spacing-0 !default;
|
||||
margin-left: $ipb-browse-brick--tree-item--has-glyphicon--description--margin-left;
|
||||
}
|
||||
|
||||
.list-group .list-group-item:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.list-group{
|
||||
margin-bottom: $ipb-browse-brick--list-group-margin-bottom;
|
||||
margin-bottom: $ipb-browse-brick--list-group--margin-bottom;
|
||||
}
|
||||
#brick_content_tree .list-group-item > .tree-item-wrapper {
|
||||
padding-bottom: 16px;
|
||||
padding-bottom: $ipb-browse-brick--list-group-item--tree-item-wrapper--padding-bottom;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
padding: 0 16px;
|
||||
}
|
||||
.list-group.tree {
|
||||
margin: 0;
|
||||
margin: $ipb-browse-brick--list-group--tree--margin;
|
||||
background-color: $ipb-browse-brick--list-group--tree--background-color;
|
||||
}
|
||||
@@ -1,19 +1,87 @@
|
||||
$ipb-manage-brick--panel--body--padding-y: $common-spacing-500 !default;
|
||||
$ipb-manage-brick--panel--body--padding-x: $common-spacing-0 !default;
|
||||
|
||||
$ipb-manage-brick--panel--body--datatable--padding-y: $common-spacing-200 !default;
|
||||
$ipb-manage-brick--panel--body--datatable--padding-x: $common-spacing-0 !default;
|
||||
$ipb-manage-brick--panel--body--datatable--row--margin: $common-spacing-0 !default;
|
||||
$ipb-manage-brick--panel--body--datatable--row--padding-y: $common-spacing-0 !default;
|
||||
$ipb-manage-brick--panel--body--datatable--row--padding-x: $common-spacing-400 !default;
|
||||
|
||||
$ipb-manage-brick--tabs--tab--border: solid 1px $common-color-grey-400 !default;
|
||||
$ipb-manage-brick--tabs--tab--badge--border-radius: $common-border-radius-500 !default;
|
||||
$ipb-manage-brick--tabs--tab--badge--padding-y: 3px !default;
|
||||
$ipb-manage-brick--tabs--tab--badge--padding-x: 5px !default;
|
||||
$ipb-manage-brick--tabs--tab--badge--margin-left: $common-spacing-200 !default;
|
||||
|
||||
$ipb-manage-brick--tabs--tab--background-color: $common-color-grey-100 !default;
|
||||
$ipb-manage-brick--tabs--tab--color: $common-color-grey-900 !default;
|
||||
$ipb-manage-brick--tabs--tab--active--background-color: $common-color-white-100 !default;
|
||||
$ipb-manage-brick--tabs--tab--active--badge--background-color: $common-color-grey-200 !default;
|
||||
$ipb-manage-brick--tabs--tab--active--indicator--background-color: $common-color-primary-600 !default;
|
||||
$ipb-manage-brick--tabs--tab--active--indicator--width: $common-size-150 !default;
|
||||
$ipb-manage-brick--tabs--tab--active--indicator--height: $ipb-manage-brick--tabs--tab--active--indicator--width !default;
|
||||
$ipb-manage-brick--tabs--tab--active--indicator--margin-right: $common-spacing-300 !default;
|
||||
$ipb-manage-brick--tabs--tab--active--indicator--border-radius: $common-border-radius-full !default;
|
||||
|
||||
$ipb-manage-brick--panel--body--table--margin-top: $common-spacing-500 !default;
|
||||
|
||||
.ipb-manage-brick--panel--body {
|
||||
padding: 15px 0;
|
||||
padding: $ipb-manage-brick--panel--body--padding-y $ipb-manage-brick--panel--body--padding-x 0 $ipb-manage-brick--panel--body--padding-x;
|
||||
|
||||
> .dataTables_wrapper {
|
||||
padding: 15px 0;
|
||||
padding: $ipb-manage-brick--panel--body--datatable--padding-y $ipb-manage-brick--panel--body--datatable--padding-x;
|
||||
> .row {
|
||||
margin: 0;
|
||||
margin: $ipb-manage-brick--panel--body--datatable--row--margin;
|
||||
> div {
|
||||
padding: 0 12px;
|
||||
padding: $ipb-manage-brick--panel--body--datatable--row--padding-y $ipb-manage-brick--panel--body--datatable--row--padding-x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.ipb-manage-brick--tabs.grouping_tabs.nav-pills > li{
|
||||
> a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: $ipb-manage-brick--tabs--tab--background-color;
|
||||
color: $ipb-manage-brick--tabs--tab--color;
|
||||
|
||||
@extend %common-font-ral-med-150;
|
||||
|
||||
> .badge {
|
||||
color: $common-color-grey-900;
|
||||
background-color: transparent;
|
||||
border-radius: $ipb-manage-brick--tabs--tab--badge--border-radius;
|
||||
padding: $ipb-manage-brick--tabs--tab--badge--padding-y $ipb-manage-brick--tabs--tab--badge--padding-x;
|
||||
margin-left: $ipb-manage-brick--tabs--tab--badge--margin-left;
|
||||
}
|
||||
|
||||
border: $ipb-manage-brick--tabs--tab--border;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&.active > a {
|
||||
background-color: $ipb-manage-brick--tabs--tab--active--background-color;
|
||||
|
||||
&:before {
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
width: $ipb-manage-brick--tabs--tab--active--indicator--width;
|
||||
height: $ipb-manage-brick--tabs--tab--active--indicator--height;
|
||||
margin-right: $ipb-manage-brick--tabs--tab--active--indicator--margin-right;
|
||||
border-radius: $ipb-manage-brick--tabs--tab--active--indicator--border-radius;
|
||||
background-color: $ipb-manage-brick--tabs--tab--active--indicator--background-color;
|
||||
}
|
||||
|
||||
> .badge {
|
||||
background-color: $ipb-manage-brick--tabs--tab--active--badge--background-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ipb-manage-brick--panel--body--table {
|
||||
margin-top: 16px !important;
|
||||
margin-top: $ipb-manage-brick--panel--body--table--margin-top !important;
|
||||
}
|
||||
|
||||
.ipb-manage-brick--export-action {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
$ipb-object-brick--url-to-clipboard--opacity: 0.5 !default;
|
||||
$ipb-object-brick--url-to-clipboard-tooltip-copied--color: $common-color-green-500!default;
|
||||
$ipb-object-brick--url-to-clipboard-tooltip-copied--margin-right: $common-spacing-200!default;
|
||||
|
||||
|
||||
.url-to-clipboard{
|
||||
&.url-to-clipboard-icon {
|
||||
opacity: $ipb-object-brick--url-to-clipboard--opacity;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s linear;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Used for clipboard's tooltip, which is not part of .url-to-clipboard element
|
||||
.url-to-clipboard-tooltip-copied {
|
||||
color: $ipb-object-brick--url-to-clipboard-tooltip-copied--color;
|
||||
margin-right: $ipb-object-brick--url-to-clipboard-tooltip-copied--margin-right;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -228,25 +228,6 @@ footer{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*******************/
|
||||
/* Clipboard icons */
|
||||
/*******************/
|
||||
.url-to-clipboard{
|
||||
&.url-to-clipboard-icon {
|
||||
opacity: 0.5;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s linear;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Used for clipboard's tooltip, which is not part of .url-to-clipboard element
|
||||
.url-to-clipboard-tooltip-copied {
|
||||
color: green;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
/**************************/
|
||||
/* MagnificPopup settings */
|
||||
/**************************/
|
||||
@@ -692,22 +673,6 @@ table .group-actions a.glyphicon-menu-hamburger{
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* tree list filter data */
|
||||
.list-group-item .tree-item-wrapper .tree-item-filter-data{
|
||||
padding-top: 8px;
|
||||
color: $gray;
|
||||
font-size: .9em;
|
||||
}
|
||||
/* tree list filter data span items */
|
||||
.list-group-item .tree-item-wrapper .tree-item-filter-data span:not(:last-child):after{
|
||||
content: '●';
|
||||
margin: 0 5px;
|
||||
}
|
||||
/* tree list filter data label span items */
|
||||
.list-group-item .tree-item-wrapper .tree-item-filter-data .tree-item-filter-data-label{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
/* - Mosaic mode */
|
||||
@@ -793,26 +758,7 @@ table .group-actions a.glyphicon-menu-hamburger{
|
||||
@extend .ck-content;
|
||||
}
|
||||
|
||||
.form_field_label > .control-label[data-tooltip-instantiated="true"] {
|
||||
&::after {
|
||||
content: "\1F6C8";
|
||||
padding-left: 3px;
|
||||
vertical-align: top;
|
||||
|
||||
cursor: pointer;
|
||||
color: $gray;
|
||||
font-size: 0.85em;
|
||||
font-weight: 200;
|
||||
}
|
||||
}
|
||||
.form_field .form_mandatory .control-label:after{
|
||||
content: "\1F6C8";
|
||||
position: relative;
|
||||
left: 3px;
|
||||
color: $brand-primary;
|
||||
font-size: 0.9em;
|
||||
font-weight: 200;
|
||||
};
|
||||
/* Note: We don't put the .form_field selector as it must work for read-only */
|
||||
.form-control-static img{
|
||||
max-width: 100% !important;
|
||||
|
||||
@@ -4061,9 +4061,7 @@ a.badge:focus {
|
||||
text-decoration: none;
|
||||
cursor: pointer
|
||||
}
|
||||
.list-group .list-group-item:hover{
|
||||
background-color: rgba(254, 223, 167, 0.1);
|
||||
}
|
||||
|
||||
.list-group-item.active>.badge,
|
||||
.nav-pills>.active>a>.badge {
|
||||
color: $brand-primary;
|
||||
|
||||
@@ -29,9 +29,7 @@ $ipb-alerts-colors: (
|
||||
)
|
||||
) !default;
|
||||
|
||||
.ipb-page--session-messages .ipb-alert {
|
||||
margin-left: $ipb-alert--margin-x;
|
||||
margin-right: $ipb-alert--margin-x;
|
||||
.ipb-alert {
|
||||
margin-bottom: $ipb-alert--margin-bottom;
|
||||
background-color: $ipb-alert--background-color;
|
||||
color: $ipb-alert--message--color;
|
||||
@@ -50,6 +48,11 @@ $ipb-alerts-colors: (
|
||||
}
|
||||
}
|
||||
|
||||
.ipb-page--session-messages .ipb-alert {
|
||||
margin-left: $ipb-alert--margin-x;
|
||||
margin-right: $ipb-alert--margin-x;
|
||||
}
|
||||
|
||||
// for each alert level....
|
||||
@each $name, $alert-color in $ipb-alerts-colors {
|
||||
|
||||
|
||||
@@ -40,13 +40,6 @@ table.table > tfoot > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table.table > thead > tr > th {
|
||||
border-bottom-width: 0px;
|
||||
}
|
||||
|
||||
table.table-striped > tbody > tr:hover {
|
||||
background-color: $common-color-blue-grey-50;
|
||||
}
|
||||
|
||||
table .ipb-table--actions--wrapper {
|
||||
display: flex;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
$ipb-vendors-datatables--cell--padding-x: $common-spacing-400 !default;
|
||||
$ipb-vendors-datatables--cell--padding-y: 10px !default;
|
||||
|
||||
$ipb-vendors-datatables--columns-header--border-bottom: 2px solid $common-color-grey-400 !default;
|
||||
|
||||
$ipb-vendors--datatables--paginate-button--colors: map-get(map-get(map-get($ipb-button-colors, ''), 'default'), '') !default;
|
||||
$ipb-vendors--datatables--paginate-button--hover--colors: map-get(map-get(map-get($ipb-button-colors, ''), 'default'), ':hover') !default;
|
||||
$ipb-vendors--datatables--paginate-button--focus--colors: map-get(map-get(map-get($ipb-button-colors, ''), 'default'), ':active') !default;
|
||||
@@ -5,6 +15,85 @@ $ipb-vendors--datatables--paginate-button--disabled--colors: map-get(map-get(map
|
||||
$ipb-vendors--datatables--paginate-button--active--colors: map-get(map-get(map-get($ipb-button-colors, ''), 'primary'), '') !default;
|
||||
$ipb-vendors--datatables--paginate-button--active--hover--colors: map-get(map-get(map-get($ipb-button-colors, ''), 'primary'), ':hover') !default;
|
||||
|
||||
$ipb-vendors-datatables--row--background-color--is-odd: $common-color-white-100 !default;
|
||||
$ipb-vendors-datatables--row--background-color--is-even: $common-color-white-200 !default;
|
||||
|
||||
$ipb-vendors-datatables--row-highlight--first-cell--width: 3px !default;
|
||||
|
||||
$ipb-vendors-datatables--row-highlight--colors:(
|
||||
'red': ($common-color-red-100, $common-color-red-200),
|
||||
'danger': ($common-color-danger-200, $common-color-danger-300),
|
||||
'alert': ($common-color-red-200, $common-color-red-300),
|
||||
'orange': ($common-color-orange-100, $common-color-orange-200),
|
||||
'warning': ($common-color-warning-200, $common-color-warning-300),
|
||||
'blue': ($common-color-blue-200, $common-color-blue-300),
|
||||
'info': ($common-color-information-200, $common-color-information-300),
|
||||
'green': ($common-color-green-100, $common-color-green-200),
|
||||
'success': ($common-color-success-100, $common-color-success-200),
|
||||
) !default;
|
||||
|
||||
$ipb-vendors-datatables--row-highlight--first-cell--colors:(
|
||||
'red': ($common-color-red-300),
|
||||
'danger': ($common-color-danger-400),
|
||||
'alert': ($common-color-red-400),
|
||||
'orange': ($common-color-orange-300),
|
||||
'warning': ($common-color-warning-400),
|
||||
'blue': ($common-color-blue-400),
|
||||
'info': ($common-color-information-400),
|
||||
'green': ($common-color-green-300),
|
||||
'success': ($common-color-success-300),
|
||||
) !default;
|
||||
|
||||
.table {
|
||||
> thead, tbody, tfoot {
|
||||
> tr {
|
||||
> th, td {
|
||||
position: relative;
|
||||
padding: $ipb-vendors-datatables--cell--padding-y $ipb-vendors-datatables--cell--padding-x;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
> thead > tr > th {
|
||||
border-bottom: $ipb-vendors-datatables--columns-header--border-bottom !important;
|
||||
}
|
||||
}
|
||||
|
||||
.table-striped > tbody > tr{
|
||||
background-color: $ipb-vendors-datatables--row--background-color--is-even;
|
||||
cursor: pointer;
|
||||
&:nth-of-type(2n+1) {
|
||||
background-color: $ipb-vendors-datatables--row--background-color--is-odd;
|
||||
}
|
||||
@each $sColorLabel, $aAttributes in $ipb-vendors-datatables--row-highlight--colors {
|
||||
$sBgColor: nth($aAttributes, 1);
|
||||
$sBgColorHover: nth($aAttributes, 2);
|
||||
&.ipb-is-#{$sColorLabel}, &.#{$sColorLabel}{
|
||||
td {
|
||||
background-color: $sBgColor;
|
||||
}
|
||||
&:hover td {
|
||||
background-color: $sBgColorHover;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@each $sColorLabel, $aAttributes in $ipb-vendors-datatables--row-highlight--first-cell--colors {
|
||||
$sBgColor: nth($aAttributes, 1);
|
||||
&.ipb-is-#{$sColorLabel} td:first-child::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 3px;
|
||||
height: 100%;
|
||||
background-color: $sBgColor;
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background-color: $common-color-blue-100;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination > .paginate_button{
|
||||
> a {
|
||||
@@ -40,4 +129,8 @@ $ipb-vendors--datatables--paginate-button--active--hover--colors: map-get(map-ge
|
||||
border-color: nth($ipb-vendors--datatables--paginate-button--active--hover--colors, 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dataTables_length, .dataTables_filter, .dataTables_info {
|
||||
@extend %common-font-ral-nor-150;
|
||||
}
|
||||
@@ -93,8 +93,8 @@ class BaseElement extends HTMLElement {
|
||||
// listen click event
|
||||
eElement.addEventListener('click', (oEvent) => {
|
||||
|
||||
// prevent redirection when clicking on a button or a link
|
||||
if (oEvent.target.closest("a") || oEvent.target.closest("button")) {
|
||||
// prevent redirection when clicking on a button or a link that are not navigation-trigger
|
||||
if (oEvent.target.closest("a") && oEvent.target.closest("a").getAttribute('data-role') !== 'navigation-trigger' || oEvent.target.closest("button") && oEvent.target.closest("button").getAttribute('data-role') !== 'navigation-trigger') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,8 +237,9 @@ class ObjectController extends BrickController
|
||||
|
||||
$aData = array('sMode' => 'view');
|
||||
$aData['form'] = $this->oObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass, $sObjectId);
|
||||
$aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:View:Title', MetaModel::GetName($sObjectClass),
|
||||
$oObject->GetName());
|
||||
$aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:View:Title', $oObject->GetName());
|
||||
$aData['form']['title_complement'] = MetaModel::GetName($sObjectClass);
|
||||
|
||||
|
||||
// Add an edit button if user is allowed
|
||||
if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId)) {
|
||||
@@ -322,8 +323,8 @@ class ObjectController extends BrickController
|
||||
|
||||
$aData = array('sMode' => 'edit');
|
||||
$aData['form'] = $this->oObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass, $sObjectId);
|
||||
$aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:Edit:Title', MetaModel::GetName($sObjectClass),
|
||||
$aData['form']['object_name']);
|
||||
$aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:Edit:Title', $aData['form']['object_name']);
|
||||
$aData['form']['title_complement'] = MetaModel::GetName($sObjectClass);
|
||||
|
||||
// Preparing response
|
||||
if ($oRequest->isXmlHttpRequest())
|
||||
@@ -1015,8 +1016,8 @@ class ObjectController extends BrickController
|
||||
$aData = $aData + array(
|
||||
'form' => array(
|
||||
'id' => 'object_search_form_'.time(),
|
||||
'title' => Dict::Format('Brick:Portal:Object:Search:Regular:Title', $oTargetAttDef->GetLabel(),
|
||||
MetaModel::GetName($sTargetObjectClass)),
|
||||
'title' => Dict::Format('Brick:Portal:Object:Search:Regular:Title', $oTargetAttDef->GetLabel()),
|
||||
'title_complement' => MetaModel::GetName($sTargetObjectClass)
|
||||
),
|
||||
'aColumnProperties' => json_encode($aColumnProperties),
|
||||
'aResults' => array(
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\Portal\Twig;
|
||||
|
||||
use Combodo\iTop\Portal\Routing\UrlGenerator;
|
||||
use MetaModel;
|
||||
|
||||
class AppIconUrlAccessor
|
||||
{
|
||||
private $oUrlGenerator;
|
||||
|
||||
public function __construct(UrlGenerator $oUrlGenerator)
|
||||
{
|
||||
$this->oUrlGenerator = $oUrlGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $bIgnoreOverrideCheck bool If true, use the URL set in the configuration file even if it's not a custom value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetAppIconUrl($bIgnoreOverrideCheck = false): string
|
||||
{
|
||||
// Try if a custom URL was set in the configuration file
|
||||
if($bIgnoreOverrideCheck === true || MetaModel::GetConfig()->IsCustomValue('app_icon_url')) {
|
||||
return $_ENV['COMBODO_CONF_APP_ICON_URL'] ;
|
||||
}
|
||||
// Otherwise use the home page
|
||||
return $this->oUrlGenerator->generate('p_home');
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,6 @@
|
||||
$('ul[data-level-id="'+nodeId+'"]').append(liElem);
|
||||
spanElem.append(iconElem);
|
||||
spanElem.append(nameElem);
|
||||
spanElem.append('<div class="tree-item-filter-data">' + item['filter_data']['values_and_codes'] + '</div>');
|
||||
liElem.append(spanElem);
|
||||
|
||||
// Delegating a click on <span> to its child <a> element
|
||||
@@ -262,6 +261,13 @@
|
||||
break;
|
||||
}
|
||||
|
||||
// Add filter data if present
|
||||
if(item['filter_data']['values'] !== '')
|
||||
{
|
||||
nameElem.append('<div class="tree-item-filter-data">' + item['filter_data']['values_and_codes'] + '</div>');
|
||||
}
|
||||
|
||||
|
||||
// Building tooltip for the node
|
||||
// N°4662 - Surround tooltip with div to ensure text retrival
|
||||
if ((item.tooltip !== undefined) && ($('<div>'+item.tooltip+'</div>').text() !== ''))
|
||||
|
||||
@@ -269,21 +269,21 @@
|
||||
"rowCallback": function (oRow, oData) {
|
||||
if (oData.highlight_class !== undefined) {
|
||||
var sHighlightClass = oData.highlight_class;
|
||||
var sBSHiglightClass = '';
|
||||
var sCSSHiglightClass = '';
|
||||
|
||||
// Adding classic iTop class
|
||||
$(oRow).addClass(sHighlightClass);
|
||||
// Adding mapped BS class
|
||||
// Adding mapped ipb class
|
||||
if (sHighlightClass === '{{ constant('HILIGHT_CLASS_CRITICAL') }}') {
|
||||
sBSHiglightClass = 'danger';
|
||||
sCSSHiglightClass = 'ipb-is-danger';
|
||||
}
|
||||
else if (sHighlightClass === '{{ constant('HILIGHT_CLASS_WARNING') }}') {
|
||||
sBSHiglightClass = 'warning';
|
||||
sCSSHiglightClass = 'ipb-is-warning';
|
||||
}
|
||||
else if (sHighlightClass === '{{ constant('HILIGHT_CLASS_OK') }}') {
|
||||
sBSHiglightClass = 'success';
|
||||
sCSSHiglightClass = 'ipb-is-success';
|
||||
}
|
||||
$(oRow).addClass(sBSHiglightClass);
|
||||
$(oRow).addClass(sCSSHiglightClass);
|
||||
}
|
||||
},
|
||||
"drawCallback": function (settings) {
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
<div class="modal-body">
|
||||
<div id="export-text-result" style="display:none;">
|
||||
<p>{{ 'Core:BulkExport:ExportResult'|dict_s }}</p>
|
||||
<p id="export-error" class="alert alert-danger" role="alert"></p>
|
||||
<p id="export-error" class="ipb-alert alert alert-danger" role="alert"></p>
|
||||
</div>
|
||||
|
||||
<div id="export-feedback">
|
||||
<p id="export-excel-warning" class="alert alert-warning" role="alert">{{ 'UI:Bulk:Export:MaliciousInjection:Alert:Message'|dict_format(sWikiUrl)|raw }}</p>
|
||||
<p id="export-excel-warning" class="ipb-alert alert alert-warning" role="alert">{{ 'UI:Bulk:Export:MaliciousInjection:Alert:Message'|dict_format(sWikiUrl)|raw }}</p>
|
||||
<p class="export-message" style="text-align:center;">{{ 'ExcelExport:PreparingExport'|dict_s }}</p>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" style="width: 0%"
|
||||
|
||||
@@ -3,27 +3,27 @@
|
||||
{% block pPageBodyClass %}{{ parent() }} page_object_brick page_object_brick_as_{{ sMode }}{% endblock %}
|
||||
|
||||
{% block pMainHeader %}
|
||||
<div class="col-xs-12" id="main-header-title">
|
||||
<div id="ipb-page--main-header--information">
|
||||
{% if form.title is defined %}
|
||||
<h2>
|
||||
{% if form.title_clipboard_text is defined %}
|
||||
<i class="url-to-clipboard url-to-clipboard-icon fas fa-link fa-xs"
|
||||
data-clipboard-text="{{ form.title_clipboard_text }}"
|
||||
<div class="ipb-page--main-header--information--title">
|
||||
{% if form.title_clipboard_text is defined %}
|
||||
<i class="url-to-clipboard url-to-clipboard-icon fas fa-link fa-xs"
|
||||
data-clipboard-text="{{ form.title_clipboard_text }}"
|
||||
data-toggle="tooltip"
|
||||
data-tooltip-content="{{ 'Brick:Portal:Object:Copy:Tooltip' | dict_s }}"
|
||||
data-tooltip-html-enabled="true"
|
||||
data-copied-title="{{ 'Brick:Portal:Object:Copy:CopiedTooltip' | dict_s }}"
|
||||
data-copied-icon="fas fa-check">
|
||||
</i>
|
||||
{% endif %}
|
||||
{{ form.title|raw }}
|
||||
</h2>
|
||||
data-copied-title="{{ 'Brick:Portal:Object:Copy:CopiedTooltip' | dict_s }}"
|
||||
data-copied-icon="fas fa-check">
|
||||
</i>
|
||||
{% endif %}
|
||||
<span>{{ form.title|raw }}</span><span>{% if form.title_complement %}{{ form.title_complement|raw }}{% endif %}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block pMainContentHolder%}
|
||||
<div class="panel panel-default">
|
||||
<div class="ipb-panel panel panel-default">
|
||||
<div class="panel-body">
|
||||
{% include template(sMode, 'Combodo\\iTop\\Portal\\Controller\\ObjectController') %}
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{% extends template('modal') %}
|
||||
|
||||
{% block pModalTitle %}
|
||||
{% if form.title_clipboard_text is defined %}
|
||||
<i class="url-to-clipboard url-to-clipboard-icon fas fa-link fa-xs"
|
||||
data-clipboard-text="{{ form.title_clipboard_text }}"
|
||||
data-toggle="tooltip"
|
||||
data-tooltip-content="{{ 'Brick:Portal:Object:Copy:Tooltip' | dict_s }}"
|
||||
{% if form.title_clipboard_text is defined %}
|
||||
<i class="url-to-clipboard url-to-clipboard-icon fas fa-link fa-xs"
|
||||
data-clipboard-text="{{ form.title_clipboard_text }}"
|
||||
data-toggle="tooltip"
|
||||
data-tooltip-content="{{ 'Brick:Portal:Object:Copy:Tooltip' | dict_s }}"
|
||||
data-tooltip-html-enabled="true"
|
||||
data-copied-title="{{ 'Brick:Portal:Object:Copy:CopiedTooltip' | dict_s }}"
|
||||
data-copied-icon="fas fa-check">
|
||||
</i>
|
||||
{% endif %}
|
||||
data-copied-title="{{ 'Brick:Portal:Object:Copy:CopiedTooltip' | dict_s }}"
|
||||
data-copied-icon="fas fa-check">
|
||||
</i>
|
||||
{% endif %}
|
||||
{% if form.title is defined %}
|
||||
{{ form.title|raw }}
|
||||
<span>{{ form.title|raw }}</span>{% if form.title_complement %}<span>{{ form.title_complement|raw }}</span>{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
<input type="hidden" name="transaction_id" value="{{ form.transaction_id }}" />
|
||||
<div class="form_alerts">
|
||||
{% block pFormAlerts %}
|
||||
<div class="alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="form_fields">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
{% block pMainContentHolder%}
|
||||
{% if bDemoMode %}
|
||||
<div class="alert alert-warning">
|
||||
<div class="ipb-alert alert alert-warning">
|
||||
<span class="fas fa-info fa-2x" style="margin-right: 10px; vertical-align: sub;"></span>
|
||||
User profile edition is not available in demo mode.
|
||||
</div>
|
||||
@@ -20,15 +20,15 @@
|
||||
|
||||
<div class="form_alerts">
|
||||
{% if sMessage is defined %}
|
||||
<div id="success-message-content" class="alert alert-success" role="alert">{{ sMessage }}</div>
|
||||
<div id="success-message-content" class="ipb-alert alert alert-success" role="alert">{{ sMessage }}</div>
|
||||
{% else %}
|
||||
<div id="success-message-content" style="display:none;" class="alert alert-success" role="alert"></div>
|
||||
<div id="success-message-content" style="display:none;" class="ipb-alert alert alert-success" role="alert"></div>
|
||||
{% endif %}
|
||||
|
||||
{% if sError is defined %}
|
||||
<div id="error-message-content" class="alert alert-error alert-danger" role="alert">{{ sError }}</div>
|
||||
<div id="error-message-content" class="ipb-alert alert alert-error alert-danger" role="alert">{{ sError }}</div>
|
||||
{% else %}
|
||||
<div id="error-message-content" style="display:none;" class="alert alert-error alert-danger" role="alert"></div>
|
||||
<div id="error-message-content" style="display:none;" class="ipb-alert alert alert-error alert-danger" role="alert"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{% block pUserProfileWrapper %}
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="ipb-panel panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{{ 'Brick:Portal:UserProfile:PersonalInformations:Title'|dict_s }}</h3>
|
||||
</div>
|
||||
@@ -13,9 +13,9 @@
|
||||
<form id="{{ oContactForm.id }}" class="" method="POST" action="{{ oContactForm.renderer.GetEndpoint()|raw }}">
|
||||
<input type="hidden" name="transaction_id" value="{{ oContactForm.transaction_id }}" />
|
||||
<div class="form_alerts">
|
||||
<div class="alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
</div>
|
||||
<div class="form_fields">
|
||||
{{ oContactForm.renderer.GetBaseLayout()|raw }}
|
||||
@@ -27,15 +27,15 @@
|
||||
<div class="col-sm-6">
|
||||
{% if oBrick.GetShowPictureForm() %}
|
||||
{% block pUserProfilePictureFormContainer %}
|
||||
<div class="panel panel-default user_profile_picture">
|
||||
<div class="ipb-panel panel panel-default user_profile_picture">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{{ 'Brick:Portal:UserProfile:Photo:Title'|dict_s }}</h3>
|
||||
</div>
|
||||
<div class="panel-body" style="position: relative;">
|
||||
<div class="form_alerts">
|
||||
<div class="alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
</div>
|
||||
<form id="picture-form" method="POST" action="{{ app['url_generator'].generate('p_user_profile_brick') }}">
|
||||
<input type="hidden" name="current_values[form_type]" value="{{ constant('\\Combodo\\iTop\\Portal\\Controller\\UserProfileBrickController::ENUM_FORM_TYPE_PICTURE') }}" />
|
||||
@@ -59,16 +59,16 @@
|
||||
|
||||
{% if oBrick.GetShowPreferencesForm() %}
|
||||
{% block pUserProfilePreferencesFormContainer %}
|
||||
<div class="panel panel-default">
|
||||
<div class="ipb-panel panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{{ 'Class:appUserPreferences/Attribute:preferences'|dict_s }}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form id="{{ oPreferencesForm.id }}" class="" method="POST" action="{{ oPreferencesForm.renderer.GetEndpoint()|raw }}">
|
||||
<div class="form_alerts">
|
||||
<div class="alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
</div>
|
||||
<div class="form_fields">
|
||||
{{ oPreferencesForm.renderer.GetBaseLayout()|raw }}
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
{% if oBrick.GetShowPasswordForm() %}
|
||||
{% block pUserProfilePasswordFormContainer %}
|
||||
<div class="panel panel-default">
|
||||
<div class="ipb-panel panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{{ 'Brick:Portal:UserProfile:Password:Title'|dict_s }}</h3>
|
||||
</div>
|
||||
@@ -89,9 +89,9 @@
|
||||
{% if oPasswordForm is not null %}
|
||||
<form id="{{ oPasswordForm.id }}" class="" method="POST" action="{{ oPasswordForm.renderer.GetEndpoint()|raw }}" autocomplete="off">
|
||||
<div class="form_alerts">
|
||||
<div class="alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-success" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-warning" role="alert" style="display: none;"></div>
|
||||
<div class="ipb-alert alert alert-error alert-danger" role="alert" style="display: none;"></div>
|
||||
</div>
|
||||
<div class="form_fields">
|
||||
{{ oPasswordForm.renderer.GetBaseLayout()|raw }}
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
{% block pPageBodyWrapper %}
|
||||
{% block pEnvBannerWrapper %}
|
||||
{% if app['combodo.current_environment'] != 'production' %}
|
||||
<div id="envbanner" class="alert alert-danger" role="alert">
|
||||
<div id="envbanner" class="ipb-alert alert alert-danger" role="alert">
|
||||
{{ 'Portal:EnvironmentBanner:Title'|dict_format( app['combodo.current_environment']|upper )|raw }}
|
||||
<button type="button" onclick="window;location.href='{{ app['url_generator'].generate('p_home', {'switch_env': 'production'}) }}'">
|
||||
{{ 'Portal:EnvironmentBanner:GoToProduction'|dict_s|raw }}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{% if app['combodo.portal.instance.conf'].properties.logo is not null %}
|
||||
<div class="ipb-navigation-menu--top-part--logo">
|
||||
{% block pNavigationSideMenuLogo %}
|
||||
<a class="ipb-navigation-menu--top-part--logo--hyperlink" href="{{ app['combodo.conf.app_icon_url'] }}" title="{{ app['combodo.portal.instance.conf'].properties.name|dict_s }}">
|
||||
<a class="ipb-navigation-menu--top-part--logo--hyperlink" href="{{ app['combodo.app_icon_url'].GetAppIconUrl() }}" title="{{ app['combodo.portal.instance.conf'].properties.name|dict_s }}">
|
||||
<img class="ipb-navigation-menu--top-part--logo--image" src="{{ app['combodo.portal.instance.conf'].properties.logo }}" alt="{{ app['combodo.portal.instance.conf'].properties.name|dict_s }}"/>
|
||||
</a>
|
||||
{% endblock %}
|
||||
|
||||
@@ -66,6 +66,7 @@ return array(
|
||||
'Combodo\\iTop\\Portal\\Service\\TemplatesProvider\\TemplatesRegister' => $baseDir . '/src/Service/TemplatesProvider/TemplatesRegister.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppExtension' => $baseDir . '/src/Twig/AppExtension.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppGlobal' => $baseDir . '/src/Twig/AppGlobal.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppIconUrlAccessor' => $baseDir . '/src/Twig/AppIconUrlAccessor.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppVariable' => $baseDir . '/src/Twig/AppVariable.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\CKEditorExtension' => $baseDir . '/src/Twig/CKEditorExtension.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\CurrentUserAccessor' => $baseDir . '/src/Twig/CurrentUserAccessor.php',
|
||||
|
||||
@@ -6,5 +6,6 @@ $vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Combodo\\iTop\\Portal\\Tests\\' => array($baseDir . '/tests'),
|
||||
'Combodo\\iTop\\Portal\\' => array($baseDir . '/src'),
|
||||
);
|
||||
|
||||
@@ -9,11 +9,16 @@ class ComposerStaticInitCombodo_ItopPortalBase_Portal
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'C' =>
|
||||
array (
|
||||
'Combodo\\iTop\\Portal\\Tests\\' => 26,
|
||||
'Combodo\\iTop\\Portal\\' => 20,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Combodo\\iTop\\Portal\\Tests\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/tests',
|
||||
),
|
||||
'Combodo\\iTop\\Portal\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/src',
|
||||
@@ -81,6 +86,7 @@ class ComposerStaticInitCombodo_ItopPortalBase_Portal
|
||||
'Combodo\\iTop\\Portal\\Service\\TemplatesProvider\\TemplatesRegister' => __DIR__ . '/../..' . '/src/Service/TemplatesProvider/TemplatesRegister.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppExtension' => __DIR__ . '/../..' . '/src/Twig/AppExtension.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppGlobal' => __DIR__ . '/../..' . '/src/Twig/AppGlobal.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppIconUrlAccessor' => __DIR__ . '/../..' . '/src/Twig/AppIconUrlAccessor.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\AppVariable' => __DIR__ . '/../..' . '/src/Twig/AppVariable.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\CKEditorExtension' => __DIR__ . '/../..' . '/src/Twig/CKEditorExtension.php',
|
||||
'Combodo\\iTop\\Portal\\Twig\\CurrentUserAccessor' => __DIR__ . '/../..' . '/src/Twig/CurrentUserAccessor.php',
|
||||
|
||||
@@ -494,7 +494,6 @@ return array(
|
||||
'Combodo\\iTop\\Service\\Base\\ObjectRepository' => $baseDir . '/sources/Service/Base/ObjectRepository.php',
|
||||
'Combodo\\iTop\\Service\\Base\\iDataPostProcessor' => $baseDir . '/sources/Service/Base/iDataPostProcessor.php',
|
||||
'Combodo\\iTop\\Service\\Cache\\DataModelDependantCache' => $baseDir . '/sources/Service/Cache/DataModelDependantCache.php',
|
||||
'Combodo\\iTop\\Service\\Cron\\CronLog' => $baseDir . '/sources/Service/Cron/CronLog.php',
|
||||
'Combodo\\iTop\\Service\\Events\\Description\\EventDataDescription' => $baseDir . '/sources/Service/Events/Description/EventDataDescription.php',
|
||||
'Combodo\\iTop\\Service\\Events\\Description\\EventDescription' => $baseDir . '/sources/Service/Events/Description/EventDescription.php',
|
||||
'Combodo\\iTop\\Service\\Events\\EventData' => $baseDir . '/sources/Service/Events/EventData.php',
|
||||
@@ -3231,5 +3230,5 @@ return array(
|
||||
'privUITransactionFile' => $baseDir . '/application/transaction.class.inc.php',
|
||||
'privUITransactionSession' => $baseDir . '/application/transaction.class.inc.php',
|
||||
'utils' => $baseDir . '/application/utils.inc.php',
|
||||
'©' => $vendorDir . '/symfony/cache/Traits/ValueWrapper.php',
|
||||
'<EFBFBD>' => $vendorDir . '/symfony/cache/Traits/ValueWrapper.php',
|
||||
);
|
||||
|
||||
@@ -884,7 +884,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\Service\\Base\\ObjectRepository' => __DIR__ . '/../..' . '/sources/Service/Base/ObjectRepository.php',
|
||||
'Combodo\\iTop\\Service\\Base\\iDataPostProcessor' => __DIR__ . '/../..' . '/sources/Service/Base/iDataPostProcessor.php',
|
||||
'Combodo\\iTop\\Service\\Cache\\DataModelDependantCache' => __DIR__ . '/../..' . '/sources/Service/Cache/DataModelDependantCache.php',
|
||||
'Combodo\\iTop\\Service\\Cron\\CronLog' => __DIR__ . '/../..' . '/sources/Service/Cron/CronLog.php',
|
||||
'Combodo\\iTop\\Service\\Events\\Description\\EventDataDescription' => __DIR__ . '/../..' . '/sources/Service/Events/Description/EventDataDescription.php',
|
||||
'Combodo\\iTop\\Service\\Events\\Description\\EventDescription' => __DIR__ . '/../..' . '/sources/Service/Events/Description/EventDescription.php',
|
||||
'Combodo\\iTop\\Service\\Events\\EventData' => __DIR__ . '/../..' . '/sources/Service/Events/EventData.php',
|
||||
@@ -3621,7 +3620,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'privUITransactionFile' => __DIR__ . '/../..' . '/application/transaction.class.inc.php',
|
||||
'privUITransactionSession' => __DIR__ . '/../..' . '/application/transaction.class.inc.php',
|
||||
'utils' => __DIR__ . '/../..' . '/application/utils.inc.php',
|
||||
'©' => __DIR__ . '/..' . '/symfony/cache/Traits/ValueWrapper.php',
|
||||
'<EFBFBD>' => __DIR__ . '/..' . '/symfony/cache/Traits/ValueWrapper.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
|
||||
@@ -317,12 +317,10 @@ class MFCompiler
|
||||
|
||||
try
|
||||
{
|
||||
SetupLog::Info("Compiling $sTempTargetDir...");
|
||||
$this->DoCompile($sTempTargetDir, $sFinalTargetDir, $oP = null, $bUseSymbolicLinks);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
SetupLog::Info("Compiling error: ".$e->getMessage());
|
||||
if ($sTempTargetDir != $sFinalTargetDir)
|
||||
{
|
||||
// Cleanup the temporary directory
|
||||
@@ -2136,6 +2134,7 @@ EOF
|
||||
$this->CompileCommonProperty('default_value', $oField, $aParameters, $sModuleRelativeDir, '');
|
||||
$this->CompileCommonProperty('is_null_allowed', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$this->CompileCommonProperty('allowed_values', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('computed', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$aParameters['depends_on'] = $sDependencies;
|
||||
} elseif ($sAttType == 'AttributeEnum') {
|
||||
$this->CompileAttributeEnumValues($sModuleRelativeDir, $sClass, $sAttCode, $oField, $aParameters, $sCss);
|
||||
@@ -2143,6 +2142,7 @@ EOF
|
||||
$this->CompileCommonProperty('sql', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('default_value', $oField, $aParameters, $sModuleRelativeDir, '');
|
||||
$this->CompileCommonProperty('is_null_allowed', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$this->CompileCommonProperty('computed', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$aParameters['depends_on'] = $sDependencies;
|
||||
} elseif ($sAttType == 'AttributeMetaEnum') {
|
||||
$this->CompileAttributeEnumValues($sModuleRelativeDir, $sClass, $sAttCode, $oField, $aParameters, $sCss);
|
||||
@@ -2271,6 +2271,7 @@ EOF
|
||||
$this->CompileCommonProperty('is_null_allowed', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$this->CompileCommonProperty('default_value', $oField, $aParameters, $sModuleRelativeDir, '');
|
||||
$this->CompileCommonProperty('allowed_values', $oField, $aParameters, $sModuleRelativeDir);
|
||||
$this->CompileCommonProperty('computed', $oField, $aParameters, $sModuleRelativeDir, false);
|
||||
$aParameters['depends_on'] = $sDependencies;
|
||||
}
|
||||
|
||||
@@ -2415,7 +2416,19 @@ EOF
|
||||
}
|
||||
$aParameters['thresholds'] = 'array('.implode(', ', $aThresholds).')';
|
||||
break;
|
||||
case 'computed':
|
||||
$oComputed = $oField->GetOptionalElement('computed');
|
||||
if(is_null($oComputed)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$sExpression = self::QuoteForPHP($oComputed->GetChildText('expression'));
|
||||
if(is_null($sExpression) || $sExpression === '') {
|
||||
throw new DOMFormatException("missing (or empty) mandatory tag expression under the tag '".$oField->nodeName."'");
|
||||
}
|
||||
|
||||
$aParameters['expression'] = $sExpression;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2038,47 +2038,36 @@ JS
|
||||
*/
|
||||
private static function WaitCronTermination($oConfig, $sMode)
|
||||
{
|
||||
$iMaxDuration = $oConfig->Get('cron_max_execution_time');
|
||||
// Avoid PHP stopping while waiting the cron
|
||||
set_time_limit($iMaxDuration);
|
||||
try {
|
||||
try
|
||||
{
|
||||
// Wait for cron to stop
|
||||
if (is_null($oConfig) || ContextTag::Check(ContextTag::TAG_CRON)) {
|
||||
return;
|
||||
}
|
||||
// Limit the number of cron process to run in parallel
|
||||
$iMaxCronProcess = $oConfig->Get('cron.max_processes');
|
||||
// Use mutex to check if cron is running
|
||||
$oMutex = new iTopMutex(
|
||||
'cron'.$oConfig->Get('db_name').$oConfig->Get('db_subname'),
|
||||
$oConfig->Get('db_host'),
|
||||
$oConfig->Get('db_user'),
|
||||
$oConfig->Get('db_pwd'),
|
||||
$oConfig->Get('db_tls.enabled'),
|
||||
$oConfig->Get('db_tls.ca')
|
||||
);
|
||||
$iCount = 1;
|
||||
$iTimeLimit = time() + $iMaxDuration;
|
||||
do {
|
||||
$bIsRunning = false;
|
||||
// Use all mutexes to check if cron is running
|
||||
for ($i = 0; $i < $iMaxCronProcess; $i++) {
|
||||
$sName = "cron#$i";
|
||||
|
||||
$oMutex = new iTopMutex(
|
||||
$sName.$oConfig->Get('db_name').$oConfig->Get('db_subname'),
|
||||
$oConfig->Get('db_host'),
|
||||
$oConfig->Get('db_user'),
|
||||
$oConfig->Get('db_pwd'),
|
||||
$oConfig->Get('db_tls.enabled'),
|
||||
$oConfig->Get('db_tls.ca')
|
||||
);
|
||||
if ($oMutex->IsLocked()) {
|
||||
$bIsRunning = true;
|
||||
SetupLog::Info("Waiting for cron to stop ($iCount)");
|
||||
$iCount++;
|
||||
sleep(1);
|
||||
if (time() > $iTimeLimit) {
|
||||
SetupLog::Error("Cannot enter $sMode mode, consider stopping the cron temporarily");
|
||||
throw new Exception("Cannot enter $sMode mode, consider stopping the cron temporarily");
|
||||
}
|
||||
break;
|
||||
}
|
||||
$iStarted = time();
|
||||
$iMaxDuration = $oConfig->Get('cron_max_execution_time');
|
||||
$iTimeLimit = $iStarted + $iMaxDuration;
|
||||
while ($oMutex->IsLocked())
|
||||
{
|
||||
SetupLog::Info("Waiting for cron to stop ($iCount)");
|
||||
$iCount++;
|
||||
sleep(1);
|
||||
if (time() > $iTimeLimit)
|
||||
{
|
||||
throw new Exception("Cannot enter $sMode mode, consider stopping the cron temporarily");
|
||||
}
|
||||
} while ($bIsRunning);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Ignore errors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Service\Cron;
|
||||
|
||||
use LogAPI;
|
||||
use Page;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class CronLog extends LogAPI
|
||||
{
|
||||
public static int $iProcessNumber = 0;
|
||||
private static int $iDebugLevel = 0;
|
||||
private static ?Page $oP = null;
|
||||
|
||||
const CHANNEL_DEFAULT = 'Cron';
|
||||
/**
|
||||
* @inheritDoc
|
||||
*
|
||||
* As this object is used during setup, without any conf file available, customizing the level can be done by changing this constant !
|
||||
*/
|
||||
const LEVEL_DEFAULT = self::LEVEL_INFO;
|
||||
|
||||
protected static $m_oFileLog = null;
|
||||
|
||||
public static function Log($sLevel, $sMessage, $sChannel = null, $aContext = []): void
|
||||
{
|
||||
$sMessage = 'cron'.str_pad(static::$iProcessNumber, 3).$sMessage;
|
||||
parent::Log($sLevel, $sMessage, $sChannel, $aContext);
|
||||
}
|
||||
|
||||
public static function Debug($sMessage, $sChannel = null, $aContext = []): void
|
||||
{
|
||||
if (self::$iDebugLevel > 0 && self::$oP) {
|
||||
self::$oP->p('cron'.str_pad(static::$iProcessNumber, 3).$sMessage);
|
||||
}
|
||||
parent::Debug($sMessage, $sChannel, $aContext);
|
||||
}
|
||||
|
||||
public static function Trace($sMessage, $sChannel = null, $aContext = []): void
|
||||
{
|
||||
if (self::$iDebugLevel > 1 && self::$oP) {
|
||||
self::$oP->p('cron'.str_pad(static::$iProcessNumber, 3).$sMessage);
|
||||
}
|
||||
parent::Trace($sMessage, $sChannel, $aContext);
|
||||
}
|
||||
|
||||
public static function SetDebug(Page $oP, int $iDebugLevel): void
|
||||
{
|
||||
self::$oP = $oP;
|
||||
self::$iDebugLevel = $iDebugLevel;
|
||||
}
|
||||
|
||||
public static function GetDebugClassName($sTaskClass): string
|
||||
{
|
||||
if (utils::StartsWith($sTaskClass, 'Combodo\\iTop\\Service\\')) {
|
||||
return substr($sTaskClass, strlen('Combodo\\iTop\\Service\\'));
|
||||
}
|
||||
if (utils::StartsWith($sTaskClass, 'Combodo\\iTop\\')) {
|
||||
return substr($sTaskClass, strlen('Combodo\\iTop\\'));
|
||||
}
|
||||
return $sTaskClass;
|
||||
}
|
||||
}
|
||||
@@ -18,20 +18,17 @@
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Application\WebPage\CLIPage;
|
||||
use Combodo\iTop\Application\WebPage\Page;
|
||||
use Combodo\iTop\Application\WebPage\WebPage;
|
||||
use Combodo\iTop\Service\Cron\CronLog;
|
||||
use Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery;
|
||||
|
||||
if (!defined('__DIR__')) {
|
||||
define('__DIR__', dirname(__FILE__));
|
||||
}
|
||||
|
||||
require_once(__DIR__.'/../approot.inc.php');
|
||||
|
||||
const EXIT_CODE_ERROR = -1;
|
||||
const EXIT_CODE_FATAL = -2;
|
||||
// early exit
|
||||
if (file_exists(READONLY_MODE_FILE)) {
|
||||
if (file_exists(READONLY_MODE_FILE))
|
||||
{
|
||||
echo "iTop is read-only. Exiting...\n";
|
||||
exit(EXIT_CODE_ERROR);
|
||||
}
|
||||
@@ -40,7 +37,8 @@ require_once(APPROOT.'/application/application.inc.php');
|
||||
require_once(APPROOT.'/core/background.inc.php');
|
||||
|
||||
$sConfigFile = APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE;
|
||||
if (!file_exists($sConfigFile)) {
|
||||
if (!file_exists($sConfigFile))
|
||||
{
|
||||
echo "iTop is not yet installed. Exiting...\n";
|
||||
exit(EXIT_CODE_ERROR);
|
||||
}
|
||||
@@ -52,7 +50,8 @@ $oCtx = new ContextTag(ContextTag::TAG_CRON);
|
||||
function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter = 'parameter')
|
||||
{
|
||||
$sValue = utils::ReadParam($sParam, null, true, $sSanitizationFilter);
|
||||
if (is_null($sValue)) {
|
||||
if (is_null($sValue))
|
||||
{
|
||||
$oP->p("ERROR: Missing argument '$sParam'\n");
|
||||
UsageAndExit($oP);
|
||||
}
|
||||
@@ -64,10 +63,13 @@ function UsageAndExit($oP)
|
||||
{
|
||||
$bModeCLI = ($oP instanceof CLIPage);
|
||||
|
||||
if ($bModeCLI) {
|
||||
if ($bModeCLI)
|
||||
{
|
||||
$oP->p("USAGE:\n");
|
||||
$oP->p("php cron.php --auth_user=<login> --auth_pwd=<password> [--param_file=<file>] [--verbose=0] [--status_only=1]\n");
|
||||
} else {
|
||||
$oP->p("php cron.php --auth_user=<login> --auth_pwd=<password> [--param_file=<file>] [--verbose=1] [--debug=1] [--status_only=1]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
$oP->p("Optional parameters: verbose, param_file, status_only\n");
|
||||
}
|
||||
$oP->output();
|
||||
@@ -94,64 +96,92 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit)
|
||||
$oProcess = new $TaskClass;
|
||||
$oRefClass = new ReflectionClass(get_class($oProcess));
|
||||
$oDateStarted = new DateTime();
|
||||
$oDatePlanned = new DateTime($oTask->Get('next_run_date'));
|
||||
$fStart = microtime(true);
|
||||
$oCtx = new ContextTag('CRON:Task:'.$TaskClass);
|
||||
|
||||
$sMessage = '';
|
||||
$oExceptionToThrow = null;
|
||||
try {
|
||||
try
|
||||
{
|
||||
// Record (when starting) that this task was started, just in case it crashes during the execution
|
||||
if ($oTask->Get('total_exec_count') == 0) {
|
||||
// First execution
|
||||
$oTask->Set('first_run_date', $oDateStarted->format('Y-m-d H:i:s'));
|
||||
}
|
||||
$oTask->Set('latest_run_date', $oDateStarted->format('Y-m-d H:i:s'));
|
||||
// Record the current user running the cron
|
||||
$oTask->Set('system_user', utils::GetCurrentUserName());
|
||||
$oTask->Set('running', 1);
|
||||
// Compute the next run date
|
||||
if ($oRefClass->implementsInterface('iScheduledProcess')) {
|
||||
// Schedules process do repeat at specific moments
|
||||
$oPlannedStart = $oProcess->GetNextOccurrence();
|
||||
} else {
|
||||
// Background processes do repeat periodically
|
||||
$oDatePlanned = new DateTime($oTask->Get('next_run_date'));
|
||||
$oPlannedStart = clone $oDatePlanned;
|
||||
// Let's schedule from the previous planned date of execution to avoid shift
|
||||
$oPlannedStart->modify('+'.$oProcess->GetPeriodicity().' seconds');
|
||||
$oNow = new DateTime();
|
||||
while ($oPlannedStart->format('U') <= $oNow->format('U')) {
|
||||
// Next planned start is already in the past, increase it again by a period
|
||||
$oPlannedStart = $oPlannedStart->modify('+'.$oProcess->GetPeriodicity().' seconds');
|
||||
$oTask->DBUpdate();
|
||||
// Time in seconds allowed to the task
|
||||
$iCurrTimeLimit = $iTimeLimit;
|
||||
// Compute allowed time
|
||||
if ($oRefClass->implementsInterface('iScheduledProcess') === false)
|
||||
{
|
||||
// Periodic task, allow only X times ($iMaxTaskExecutionTime) its periodicity (GetPeriodicity())
|
||||
$iMaxTaskExecutionTime = MetaModel::GetConfig()->Get('cron_task_max_execution_time');
|
||||
$iTaskLimit = time() + $oProcess->GetPeriodicity() * $iMaxTaskExecutionTime;
|
||||
// If our proposed time limit is less than cron limit, and cron_task_max_execution_time is > 0
|
||||
if ($iTaskLimit < $iTimeLimit && $iMaxTaskExecutionTime > 0)
|
||||
{
|
||||
$iCurrTimeLimit = $iTaskLimit;
|
||||
}
|
||||
}
|
||||
$oTask->Set('next_run_date', $oPlannedStart->format('Y-m-d H:i:s'));
|
||||
$oTask->DBUpdate();
|
||||
|
||||
$sMessage = $oProcess->Process($iTimeLimit);
|
||||
$sMessage = $oProcess->Process($iCurrTimeLimit);
|
||||
$oTask->Set('running', 0);
|
||||
}
|
||||
catch (MySQLHasGoneAwayException $e) {
|
||||
catch (MySQLHasGoneAwayException $e)
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
catch (ProcessFatalException $e) {
|
||||
catch (ProcessFatalException $e)
|
||||
{
|
||||
$oExceptionToThrow = $e;
|
||||
}
|
||||
catch (Exception $e) // we shouldn't get so much exceptions... but we need to handle legacy code, and cron.php has to keep running
|
||||
{
|
||||
if ($oTask->IsDebug()) {
|
||||
$sMessage = 'Processing failed with message: '.$e->getMessage().'. '.$e->getTraceAsString();
|
||||
} else {
|
||||
$sMessage = 'Processing failed with message: '.$e->getMessage();
|
||||
if ($oTask->IsDebug())
|
||||
{
|
||||
$sMessage = 'Processing failed with message: '. $e->getMessage() . '. ' . $e->getTraceAsString();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sMessage = 'Processing failed with message: '. $e->getMessage();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$oTask->Set('running', 0);
|
||||
$fDuration = microtime(true) - $fStart;
|
||||
$oTask->ComputeDurations($fDuration); // does increment the counter and compute statistics
|
||||
$oTask->DBUpdate();
|
||||
$fDuration = microtime(true) - $fStart;
|
||||
if ($oTask->Get('total_exec_count') == 0)
|
||||
{
|
||||
// First execution
|
||||
$oTask->Set('first_run_date', $oDateStarted->format('Y-m-d H:i:s'));
|
||||
}
|
||||
$oTask->ComputeDurations($fDuration); // does increment the counter and compute statistics
|
||||
|
||||
// Update the timestamp since we want to be able to re-order the tasks based on the time they finished
|
||||
$oDateEnded = new DateTime();
|
||||
$oTask->Set('latest_run_date', $oDateEnded->format('Y-m-d H:i:s'));
|
||||
|
||||
if ($oRefClass->implementsInterface('iScheduledProcess'))
|
||||
{
|
||||
// Schedules process do repeat at specific moments
|
||||
$oPlannedStart = $oProcess->GetNextOccurrence();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Background processes do repeat periodically
|
||||
$oPlannedStart = clone $oDatePlanned;
|
||||
// Let's schedule from the previous planned date of execution to avoid shift
|
||||
$oPlannedStart->modify($oProcess->GetPeriodicity().' seconds');
|
||||
$oEnd = new DateTime();
|
||||
while ($oPlannedStart->format('U') < $oEnd->format('U'))
|
||||
{
|
||||
// Next planned start is already in the past, increase it again by a period
|
||||
$oPlannedStart = $oPlannedStart->modify('+'.$oProcess->GetPeriodicity().' seconds');
|
||||
}
|
||||
}
|
||||
|
||||
if ($oExceptionToThrow) {
|
||||
$oTask->Set('next_run_date', $oPlannedStart->format('Y-m-d H:i:s'));
|
||||
$oTask->DBUpdate();
|
||||
|
||||
if ($oExceptionToThrow)
|
||||
{
|
||||
throw $oExceptionToThrow;
|
||||
}
|
||||
|
||||
@@ -161,6 +191,8 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CLIPage|WebPage $oP
|
||||
* @param boolean $bVerbose
|
||||
*
|
||||
* @param bool $bDebug
|
||||
*
|
||||
@@ -175,31 +207,24 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit)
|
||||
* @throws \OQLException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
function CronExec($bDebug)
|
||||
function CronExec($oP, $bVerbose, $bDebug=false)
|
||||
{
|
||||
$iStarted = time();
|
||||
$iMaxDuration = MetaModel::GetConfig()->Get('cron_max_execution_time');
|
||||
$iTimeLimit = $iStarted + $iMaxDuration;
|
||||
$iCronSleep = MetaModel::GetConfig()->Get('cron_sleep');
|
||||
$iMaxCronProcess = max(MetaModel::GetConfig()->Get('cron.max_processes'), 1);
|
||||
|
||||
// Allow a time slot for every task
|
||||
// knowing that there are $iMaxCronProcess running in parallel for the amount of tasks
|
||||
$oSearch = new DBObjectSearch('BackgroundTask');
|
||||
$oSearch->AddCondition('status', 'active');
|
||||
$oTasks = new DBObjectSet($oSearch);
|
||||
$iCount = $oTasks->Count();
|
||||
$iTotalAvailableTime = $iMaxDuration * $iMaxCronProcess;
|
||||
$iTimeSlot = (int)($iTotalAvailableTime / max($iCount, 1));
|
||||
if ($bVerbose)
|
||||
{
|
||||
$oP->p("Planned duration = $iMaxDuration seconds");
|
||||
$oP->p("Loop pause = $iCronSleep seconds");
|
||||
}
|
||||
|
||||
CronLog::Trace("Planned duration = $iMaxDuration seconds");
|
||||
CronLog::Trace("Planned duration per task = $iTimeSlot seconds");
|
||||
CronLog::Trace("Loop pause = $iCronSleep seconds");
|
||||
ReSyncProcesses($oP, $bVerbose, $bDebug);
|
||||
|
||||
ReSyncProcesses($bDebug);
|
||||
|
||||
while (time() < $iTimeLimit) {
|
||||
CheckMaintenanceMode();
|
||||
while (time() < $iTimeLimit)
|
||||
{
|
||||
CheckMaintenanceMode($oP);
|
||||
|
||||
$oNow = new DateTime();
|
||||
$sNow = $oNow->format('Y-m-d H:i:s');
|
||||
@@ -207,109 +232,120 @@ function CronExec($bDebug)
|
||||
$oSearch->AddCondition('next_run_date', $sNow, '<=');
|
||||
$oSearch->AddCondition('status', 'active');
|
||||
$oTasks = new DBObjectSet($oSearch, ['next_run_date' => true]);
|
||||
$bWorkDone = false;
|
||||
|
||||
$aTasks = [];
|
||||
if ($oTasks->CountExceeds(0)) {
|
||||
$aDebugMessages = [];
|
||||
while ($oTask = $oTasks->Fetch()) {
|
||||
$sTaskName = $oTask->Get('class_name');
|
||||
$oTaskMutex = new iTopMutex("cron_$sTaskName");
|
||||
if ($oTaskMutex->IsLocked()) {
|
||||
// Already running, ignore
|
||||
continue;
|
||||
}
|
||||
$aTasks[] = $oTask;
|
||||
$sStatus = $oTask->Get('status');
|
||||
$sLastRunDate = $oTask->Get('latest_run_date');
|
||||
$sNextRunDate = $oTask->Get('next_run_date');
|
||||
$aDebugMessages[] = sprintf('Task Class: %1$-25.25s Status: %2$-7s Last Run: %3$-19s Next Run: %4$-19s', $sTaskName, $sStatus, $sLastRunDate, $sNextRunDate);
|
||||
if ($oTasks->CountExceeds(0))
|
||||
{
|
||||
$bWorkDone = true;
|
||||
$aTasks = array();
|
||||
if ($bVerbose)
|
||||
{
|
||||
$sCount = $oTasks->Count();
|
||||
$oP->p("$sCount Tasks planned to run now ($sNow):");
|
||||
$oP->p('+---------------------------+---------+---------------------+---------------------+');
|
||||
$oP->p('| Task Class | Status | Last Run | Next Run |');
|
||||
$oP->p('+---------------------------+---------+---------------------+---------------------+');
|
||||
}
|
||||
$sCount = count($aDebugMessages);
|
||||
CronLog::Trace("$sCount Tasks planned to run now ($sNow):");
|
||||
foreach ($aDebugMessages as $sDebugMessage) {
|
||||
CronLog::Trace($sDebugMessage);
|
||||
while ($oTask = $oTasks->Fetch())
|
||||
{
|
||||
$aTasks[$oTask->Get('class_name')] = $oTask;
|
||||
if ($bVerbose)
|
||||
{
|
||||
$sTaskName = $oTask->Get('class_name');
|
||||
$sStatus = $oTask->Get('status');
|
||||
$sLastRunDate = $oTask->Get('latest_run_date');
|
||||
$sNextRunDate = $oTask->Get('next_run_date');
|
||||
$oP->p(sprintf('| %1$-25.25s | %2$-7s | %3$-19s | %4$-19s |', $sTaskName, $sStatus, $sLastRunDate, $sNextRunDate));
|
||||
}
|
||||
}
|
||||
if ($bVerbose)
|
||||
{
|
||||
$oP->p('+---------------------------+---------+---------------------+---------------------+');
|
||||
}
|
||||
$aRunTasks = [];
|
||||
while (count($aTasks) > 0) {
|
||||
$oTask = array_shift($aTasks);
|
||||
|
||||
foreach ($aTasks as $oTask)
|
||||
{
|
||||
$sTaskClass = $oTask->Get('class_name');
|
||||
|
||||
// Check if the current task is running
|
||||
$oTaskMutex = new iTopMutex("cron_$sTaskClass");
|
||||
if (!$oTaskMutex->TryLock()) {
|
||||
// Task is already running, try next one
|
||||
continue;
|
||||
}
|
||||
|
||||
$aRunTasks[] = $sTaskClass;
|
||||
|
||||
// N°3219 for each process will use a specific CMDBChange object with a specific track info
|
||||
// Any BackgroundProcess can override this as needed
|
||||
// Any BackgroundProcess can overrides this as needed
|
||||
CMDBObject::SetCurrentChangeFromParams("Background task ($sTaskClass)");
|
||||
|
||||
// Run the task and record its next run time
|
||||
$sDebugTaskClass = CronLog::GetDebugClassName($sTaskClass);
|
||||
$oNow = new DateTime();
|
||||
CronLog::Debug(sprintf("> Starting >>> %-'>49s", $sDebugTaskClass.' '));
|
||||
try {
|
||||
// The limit of time for this task corresponds to the time slot allowed for every task
|
||||
// but limited to the cron job time limit
|
||||
$sMessage = RunTask($oTask, min($iTimeLimit, time() + $iTimeSlot));
|
||||
if ($bVerbose)
|
||||
{
|
||||
$oNow = new DateTime();
|
||||
$oP->p(">> === ".$oNow->format('Y-m-d H:i:s').sprintf(" Starting:%-'=49s", ' '.$sTaskClass.' '));
|
||||
}
|
||||
catch (MySQLHasGoneAwayException $e) {
|
||||
CronLog::Error("ERROR : 'MySQL has gone away' thrown when processing $sDebugTaskClass (error_code=".$e->getCode().")", CronLog::CHANNEL_DEFAULT, ['stack' => $e->getTraceAsString()]);
|
||||
try
|
||||
{
|
||||
$sMessage = RunTask($aTasks[$sTaskClass], $iTimeLimit);
|
||||
} catch (MySQLHasGoneAwayException $e)
|
||||
{
|
||||
$oP->p("ERROR : 'MySQL has gone away' thrown when processing $sTaskClass (error_code=".$e->getCode().")");
|
||||
exit(EXIT_CODE_FATAL);
|
||||
} catch (ProcessFatalException $e)
|
||||
{
|
||||
$oP->p("ERROR : an exception was thrown when processing '$sTaskClass' (".$e->getInfoLog().")");
|
||||
IssueLog::Error("Cron.php error : an exception was thrown when processing '$sTaskClass' (".$e->getInfoLog().')');
|
||||
}
|
||||
catch (ProcessFatalException $e) {
|
||||
CronLog::Error("ERROR : an exception was thrown when processing '$sDebugTaskClass' (".$e->getInfoLog().")", CronLog::CHANNEL_DEFAULT, ['stack' => $e->getTraceAsString()]);
|
||||
if ($bVerbose)
|
||||
{
|
||||
if (!empty($sMessage))
|
||||
{
|
||||
$oP->p("$sTaskClass: $sMessage");
|
||||
}
|
||||
$oEnd = new DateTime();
|
||||
$sNextRunDate = $oTask->Get('next_run_date');
|
||||
$oP->p("<< === ".$oEnd->format('Y-m-d H:i:s').sprintf(" End of: %-'=42s", ' '.$sTaskClass.' ')." Next: $sNextRunDate");
|
||||
}
|
||||
finally {
|
||||
$oTaskMutex->Unlock();
|
||||
}
|
||||
if (!empty($sMessage)) {
|
||||
CronLog::Debug("$sDebugTaskClass: $sMessage");
|
||||
}
|
||||
$oEnd = new DateTime();
|
||||
$sNextRunDate = $oTask->Get('next_run_date');
|
||||
CronLog::Debug(sprintf("< Ending <<<<< %-'<49s", $sDebugTaskClass.' ')." Next: $sNextRunDate");
|
||||
if (time() > $iTimeLimit) {
|
||||
if (time() > $iTimeLimit)
|
||||
{
|
||||
break 2;
|
||||
}
|
||||
CheckMaintenanceMode();
|
||||
if ($iMaxCronProcess > 1) {
|
||||
// Reindex tasks every time
|
||||
break;
|
||||
}
|
||||
CheckMaintenanceMode($oP);
|
||||
}
|
||||
|
||||
// Tasks to run later
|
||||
if (count($aTasks) == 0) {
|
||||
if ($bVerbose)
|
||||
{
|
||||
$oP->p('--');
|
||||
$oSearch = new DBObjectSearch('BackgroundTask');
|
||||
$oSearch->AddCondition('next_run_date', $sNow, '>');
|
||||
$oSearch->AddCondition('status', 'active');
|
||||
$oTasks = new DBObjectSet($oSearch, ['next_run_date' => true]);
|
||||
while ($oTask = $oTasks->Fetch()) {
|
||||
if (!in_array($oTask->Get('class_name'), $aRunTasks)) {
|
||||
$sDebugTaskClass = CronLog::GetDebugClassName($oTask->Get('class_name'));
|
||||
CronLog::Trace(sprintf("-- Skipping task: %-'-40s", $sDebugTaskClass.' ')." until: ".$oTask->Get('next_run_date'));
|
||||
while ($oTask = $oTasks->Fetch())
|
||||
{
|
||||
if (!in_array($oTask->Get('class_name'), $aRunTasks))
|
||||
{
|
||||
$oP->p(sprintf("-- Skipping task: %-'-40s", $oTask->Get('class_name').' ')." until: ".$oTask->Get('next_run_date'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($aTasks) == 0) {
|
||||
CronLog::Trace("sleeping...");
|
||||
sleep($iCronSleep);
|
||||
|
||||
if ($bVerbose && $bWorkDone)
|
||||
{
|
||||
$oP->p("Sleeping...\n");
|
||||
}
|
||||
sleep($iCronSleep);
|
||||
}
|
||||
if ($bVerbose)
|
||||
{
|
||||
$oP->p('');
|
||||
DisplayStatus($oP, ['next_run_date' => true]);
|
||||
$oP->p("Reached normal execution time limit (exceeded by ".(time() - $iTimeLimit)."s)");
|
||||
}
|
||||
CronLog::Trace("Reached normal execution time limit (exceeded by ".(time() - $iTimeLimit)."s)");
|
||||
}
|
||||
|
||||
function CheckMaintenanceMode()
|
||||
{
|
||||
/**
|
||||
* @param WebPage $oP
|
||||
*/
|
||||
function CheckMaintenanceMode(Page $oP) {
|
||||
// Verify files instead of reloading the full config each time
|
||||
if (file_exists(MAINTENANCE_MODE_FILE) || file_exists(READONLY_MODE_FILE)) {
|
||||
CronLog::Info("Maintenance detected, exiting");
|
||||
$oP->p("Maintenance detected, exiting");
|
||||
exit(EXIT_CODE_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -324,14 +360,15 @@ function CheckMaintenanceMode()
|
||||
* @throws \MySQLException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
function DisplayStatus($oP = null, $aTaskOrderBy = [])
|
||||
function DisplayStatus($oP, $aTaskOrderBy = [])
|
||||
{
|
||||
$oSearch = new DBObjectSearch('BackgroundTask');
|
||||
$oTasks = new DBObjectSet($oSearch, $aTaskOrderBy);
|
||||
$oP->p('+---------------------------+---------+---------------------+---------------------+--------+-----------+');
|
||||
$oP->p('| Task Class | Status | Last Run | Next Run | Nb Run | Avg. Dur. |');
|
||||
$oP->p('+---------------------------+---------+---------------------+---------------------+--------+-----------+');
|
||||
while ($oTask = $oTasks->Fetch()) {
|
||||
while ($oTask = $oTasks->Fetch())
|
||||
{
|
||||
$sTaskName = $oTask->Get('class_name');
|
||||
$sStatus = $oTask->Get('status');
|
||||
$sLastRunDate = $oTask->Get('latest_run_date');
|
||||
@@ -345,6 +382,8 @@ function DisplayStatus($oP = null, $aTaskOrderBy = [])
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $oP
|
||||
* @param $bVerbose
|
||||
* @param $bDebug
|
||||
*
|
||||
* @throws \ArchivedObjectException
|
||||
@@ -356,25 +395,28 @@ function DisplayStatus($oP = null, $aTaskOrderBy = [])
|
||||
* @throws \OQLException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
function ReSyncProcesses($bDebug)
|
||||
function ReSyncProcesses($oP, $bVerbose, $bDebug)
|
||||
{
|
||||
// Enumerate classes implementing BackgroundProcess
|
||||
//
|
||||
$oSearch = new DBObjectSearch('BackgroundTask');
|
||||
$oTasks = new DBObjectSet($oSearch);
|
||||
$aTasks = [];
|
||||
while ($oTask = $oTasks->Fetch()) {
|
||||
$aTasks = array();
|
||||
while ($oTask = $oTasks->Fetch())
|
||||
{
|
||||
$aTasks[$oTask->Get('class_name')] = $oTask;
|
||||
}
|
||||
$oNow = new DateTime();
|
||||
|
||||
$aProcesses = [];
|
||||
foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iProcess::class) as $sTaskClass) {
|
||||
$aProcesses = array();
|
||||
foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iProcess::class) as $sTaskClass)
|
||||
{
|
||||
$oProcess = new $sTaskClass;
|
||||
$aProcesses[$sTaskClass] = $oProcess;
|
||||
|
||||
// Create missing entry if needed
|
||||
if (!array_key_exists($sTaskClass, $aTasks)) {
|
||||
if (!array_key_exists($sTaskClass, $aTasks))
|
||||
{
|
||||
// New entry, let's create a new BackgroundTask record, and plan the first execution
|
||||
$oTask = new BackgroundTask();
|
||||
$oTask->SetDebug($bDebug);
|
||||
@@ -384,31 +426,41 @@ function ReSyncProcesses($bDebug)
|
||||
$oTask->Set('max_run_duration', 0);
|
||||
$oTask->Set('average_run_duration', 0);
|
||||
$oRefClass = new ReflectionClass($sTaskClass);
|
||||
if ($oRefClass->implementsInterface('iScheduledProcess')) {
|
||||
if ($oRefClass->implementsInterface('iScheduledProcess'))
|
||||
{
|
||||
$oNextOcc = $oProcess->GetNextOccurrence();
|
||||
$oTask->Set('next_run_date', $oNextOcc->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Background processes do start asap, i.e. "now"
|
||||
$oTask->Set('next_run_date', $oNow->format('Y-m-d H:i:s'));
|
||||
}
|
||||
$sDebugTaskClass = CronLog::GetDebugClassName($sTaskClass);
|
||||
CronLog::Trace('Creating record for: '.$sDebugTaskClass);
|
||||
CronLog::Trace('First execution planned at: '.$oTask->Get('next_run_date'));
|
||||
if ($bVerbose)
|
||||
{
|
||||
$oP->p('Creating record for: '.$sTaskClass);
|
||||
$oP->p('First execution planned at: '.$oTask->Get('next_run_date'));
|
||||
}
|
||||
$oTask->DBInsert();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @var \BackgroundTask $oTask */
|
||||
$oTask = $aTasks[$sTaskClass];
|
||||
if ($oTask->Get('next_run_date') == '3000-01-01 00:00:00') {
|
||||
if ($oTask->Get('next_run_date') == '3000-01-01 00:00:00')
|
||||
{
|
||||
// check for rescheduled tasks
|
||||
$oRefClass = new ReflectionClass($sTaskClass);
|
||||
if ($oRefClass->implementsInterface('iScheduledProcess')) {
|
||||
if ($oRefClass->implementsInterface('iScheduledProcess'))
|
||||
{
|
||||
$oNextOcc = $oProcess->GetNextOccurrence();
|
||||
$oTask->Set('next_run_date', $oNextOcc->format('Y-m-d H:i:s'));
|
||||
$oTask->DBUpdate();
|
||||
}
|
||||
}
|
||||
// Reactivate task if necessary
|
||||
if ($oTask->Get('status') == 'removed') {
|
||||
if ($oTask->Get('status') == 'removed')
|
||||
{
|
||||
$oTask->Set('status', 'active');
|
||||
$oTask->DBUpdate();
|
||||
}
|
||||
@@ -418,20 +470,26 @@ function ReSyncProcesses($bDebug)
|
||||
}
|
||||
|
||||
// Remove all the tasks not having a valid class
|
||||
foreach ($aTasks as $oTask) {
|
||||
foreach ($aTasks as $oTask)
|
||||
{
|
||||
$sTaskClass = $oTask->Get('class_name');
|
||||
if (!class_exists($sTaskClass)) {
|
||||
if (!class_exists($sTaskClass))
|
||||
{
|
||||
$oTask->Set('status', 'removed');
|
||||
$oTask->DBUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
$aDisplayProcesses = [];
|
||||
foreach ($aProcesses as $oExecInstance) {
|
||||
$aDisplayProcesses[] = get_class($oExecInstance);
|
||||
if ($bVerbose)
|
||||
{
|
||||
$aDisplayProcesses = array();
|
||||
foreach ($aProcesses as $oExecInstance)
|
||||
{
|
||||
$aDisplayProcesses[] = get_class($oExecInstance);
|
||||
}
|
||||
$sDisplayProcesses = implode(', ', $aDisplayProcesses);
|
||||
$oP->p("Background processes: ".$sDisplayProcesses);
|
||||
}
|
||||
$sDisplayProcesses = implode(', ', $aDisplayProcesses);
|
||||
CronLog::Trace("Background processes: ".$sDisplayProcesses);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -442,91 +500,118 @@ function ReSyncProcesses($bDebug)
|
||||
set_time_limit(0); // Some background actions may really take long to finish (like backup)
|
||||
|
||||
$bIsModeCLI = utils::IsModeCLI();
|
||||
if ($bIsModeCLI) {
|
||||
if ($bIsModeCLI)
|
||||
{
|
||||
$oP = new CLIPage("iTop - cron");
|
||||
|
||||
SetupUtils::CheckPhpAndExtensionsForCli($oP, EXIT_CODE_FATAL);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$oP = new WebPage("iTop - cron");
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
utils::UseParamFile();
|
||||
|
||||
// Allow verbosity on output from 0 => none, 1 => debug, 2 => trace
|
||||
// (writing debug messages to the cron.log file is configured with log_level_min config parameter)
|
||||
$iVerbose = utils::ReadParam('verbose', 0, true /* Allow CLI */);
|
||||
CronLog::SetDebug($oP, $iVerbose);
|
||||
$bVerbose = utils::ReadParam('verbose', false, true /* Allow CLI */);
|
||||
$bDebug = utils::ReadParam('debug', false, true /* Allow CLI */);
|
||||
|
||||
if ($bIsModeCLI) {
|
||||
if ($bIsModeCLI)
|
||||
{
|
||||
// Next steps:
|
||||
// specific arguments: 'csv file'
|
||||
//
|
||||
$sAuthUser = ReadMandatoryParam($oP, 'auth_user', 'raw_data');
|
||||
$sAuthPwd = ReadMandatoryParam($oP, 'auth_pwd', 'raw_data');
|
||||
if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) {
|
||||
if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd))
|
||||
{
|
||||
UserRights::Login($sAuthUser); // Login & set the user's language
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$oP->p("Access wrong credentials ('$sAuthUser')");
|
||||
$oP->output();
|
||||
exit(EXIT_CODE_ERROR);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(APPROOT.'/application/loginwebpage.class.inc.php');
|
||||
LoginWebPage::DoLogin(); // Check user rights and prompt if needed
|
||||
}
|
||||
|
||||
if (!UserRights::IsAdministrator()) {
|
||||
if (!UserRights::IsAdministrator())
|
||||
{
|
||||
$oP->p("Access restricted to administrators");
|
||||
$oP->Output();
|
||||
exit(EXIT_CODE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
if (utils::ReadParam('status_only', false, true /* Allow CLI */)) {
|
||||
if (utils::ReadParam('status_only', false, true /* Allow CLI */))
|
||||
{
|
||||
// Display status and exit
|
||||
DisplayStatus($oP);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
require_once(APPROOT.'core/mutex.class.inc.php');
|
||||
$oP->p("Starting: ".time().' ('.date('Y-m-d H:i:s').')');
|
||||
}
|
||||
catch (Exception $e) {
|
||||
catch (Exception $e)
|
||||
{
|
||||
$oP->p("Error: ".$e->GetMessage());
|
||||
$oP->output();
|
||||
exit(EXIT_CODE_FATAL);
|
||||
}
|
||||
|
||||
CronLog::Enable(APPROOT.'/log/error.log');
|
||||
try {
|
||||
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) {
|
||||
CronLog::Debug("A maintenance is ongoing");
|
||||
} else {
|
||||
// Limit the number of cron process to run in parallel
|
||||
$iMaxCronProcess = max(MetaModel::GetConfig()->Get('cron.max_processes'), 1);
|
||||
$bCanRun = false;
|
||||
$iProcessNumber = 0;
|
||||
for ($i = 0; $i < $iMaxCronProcess; $i++) {
|
||||
$oMutex = new iTopMutex("cron#$i");
|
||||
if ($oMutex->TryLock()) {
|
||||
$iProcessNumber = $i + 1;
|
||||
$bCanRun = true;
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
$oMutex = new iTopMutex('cron');
|
||||
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE))
|
||||
{
|
||||
$oP->p("A maintenance is ongoing");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($oMutex->TryLock())
|
||||
{
|
||||
CronExec($oP, $bVerbose, $bDebug);
|
||||
}
|
||||
if ($bCanRun) {
|
||||
CronLog::$iProcessNumber = $iProcessNumber;
|
||||
CronLog::Debug('Starting: '.time().' ('.date('Y-m-d H:i:s').')');
|
||||
CronExec($iVerbose > 0);
|
||||
} else {
|
||||
CronLog::$iProcessNumber = $iMaxCronProcess + 1;
|
||||
CronLog::Trace("The limit of $iMaxCronProcess cron process running in parallel is already reached");
|
||||
else
|
||||
{
|
||||
// Exit silently
|
||||
$oP->p("Already running...");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
CronLog::Error("ERROR: '".$e->getMessage()."'", CronLog::CHANNEL_DEFAULT, ['stack' => $e->getTraceAsString()]);
|
||||
catch (Exception $e)
|
||||
{
|
||||
$oP->p("ERROR: '".$e->getMessage()."'");
|
||||
if ($bDebug)
|
||||
{
|
||||
// Might contain verb parameters such a password...
|
||||
$oP->p($e->getTraceAsString());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
$oMutex->Unlock();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$oP->p("ERROR: '".$e->getMessage()."'");
|
||||
if ($bDebug)
|
||||
{
|
||||
// Might contain verb parameters such a password...
|
||||
$oP->p($e->getTraceAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CronLog::Debug("Exiting: ".time().' ('.date('Y-m-d H:i:s').')');
|
||||
$oP->p("Exiting: ".time().' ('.date('Y-m-d H:i:s').')');
|
||||
$oP->Output();
|
||||
|
||||
Reference in New Issue
Block a user