mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
New placeholders in templates: this->html(attcode) and this->label(attcode)
SVN:trunk[735]
This commit is contained in:
@@ -39,6 +39,7 @@ class FileUploadException extends Exception
|
||||
*/
|
||||
class utils
|
||||
{
|
||||
private static $m_sConfigFile = ITOP_CONFIG_FILE;
|
||||
private static $m_oConfig = null;
|
||||
|
||||
public static function ReadParam($sName, $defaultValue = "")
|
||||
@@ -136,6 +137,15 @@ class utils
|
||||
return file_get_contents($sFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the application config file
|
||||
* @param string path to the config file
|
||||
* @return void
|
||||
*/
|
||||
public static function SpecifyConfigFile($sFilePath)
|
||||
{
|
||||
self::$m_sConfigFile = $sFilePath;
|
||||
}
|
||||
/**
|
||||
* Get access to the application config file
|
||||
* @param none
|
||||
@@ -145,7 +155,7 @@ class utils
|
||||
{
|
||||
if (self::$m_oConfig == null)
|
||||
{
|
||||
self::$m_oConfig = new Config(ITOP_CONFIG_FILE);
|
||||
self::$m_oConfig = new Config(self::$m_sConfigFile);
|
||||
}
|
||||
return self::$m_oConfig;
|
||||
}
|
||||
|
||||
@@ -1096,6 +1096,10 @@ abstract class DBObject
|
||||
}
|
||||
|
||||
// Make standard context arguments
|
||||
// Note: Needs to be reviewed because it is currently called once per attribute when an object is written (CheckToWrite / CheckValue)
|
||||
// Several options here:
|
||||
// 1) cache the result
|
||||
// 2) set only the object ref and resolve the values iif needed from contextual templates and queries (easy for the queries, not for the templates)
|
||||
public function ToArgs($sArgName = 'this')
|
||||
{
|
||||
$aScalarArgs = array();
|
||||
@@ -1109,6 +1113,11 @@ abstract class DBObject
|
||||
foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
|
||||
{
|
||||
$aScalarArgs[$sArgName.'->'.$sAttCode] = $this->Get($sAttCode);
|
||||
if ($oAttDef->IsScalar())
|
||||
{
|
||||
$aScalarArgs[$sArgName.'->html('.$sAttCode.')'] = $this->GetAsHtml($sAttCode);
|
||||
$aScalarArgs[$sArgName.'->label('.$sAttCode.')'] = strip_tags($this->GetAsHtml($sAttCode));
|
||||
}
|
||||
}
|
||||
return $aScalarArgs;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<to>SELECT Team WHERE id=:this->workgroup_id</to>
|
||||
<cc></cc>
|
||||
<bcc></bcc>
|
||||
<subject>The ticket $this->name()$, priority $this->priority$ has been assigned to the workgroup $this->workgroup_name$</subject>
|
||||
<subject>The ticket $this->name()$, priority $this->label(priority)$ has been assigned to the workgroup $this->workgroup_name$</subject>
|
||||
<body><html>
|
||||
<body>
|
||||
<p>The incident ticket $this->name()$ has been assigned to the workgroup $this->workgroup_name$.</p>
|
||||
@@ -32,7 +32,7 @@
|
||||
<to>SELECT Person WHERE id=:this->agent_id</to>
|
||||
<cc></cc>
|
||||
<bcc></bcc>
|
||||
<subject>The ticket $this->name()$, priority $this->priority$ has been assigned to you</subject>
|
||||
<subject>The ticket $this->name()$, priority $this->label(priority)$ has been assigned to you</subject>
|
||||
<body><html>
|
||||
<body>
|
||||
<p>The incident ticket $this->name()$ has been assigned to you.</p>
|
||||
@@ -54,7 +54,7 @@
|
||||
<to>SELECT Person WHERE id=:this->caller_id</to>
|
||||
<cc></cc>
|
||||
<bcc></bcc>
|
||||
<subject>Ticket $this->name()$, priority $this->priority$ - $this->ticket_status$</subject>
|
||||
<subject>Ticket $this->name()$, priority $this->label(priority)$ - $this->ticket_status$</subject>
|
||||
<body><html>
|
||||
<body>
|
||||
<p>The incident ticket $this->name()$ has changed to status $this->ticket_status$</p>
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
<TriggerOnStateEnter id="5">
|
||||
<description>Incident ticket assigned to agent</description>
|
||||
<target_class>Incident</target_class>
|
||||
<state>Assigned</state>
|
||||
<state>assigned</state>
|
||||
</TriggerOnStateEnter>
|
||||
|
||||
<TriggerOnStateEnter id="6">
|
||||
<description>Incident ticket resolved</description>
|
||||
<target_class>Incident</target_class>
|
||||
<state>Resolved</state>
|
||||
<state>resolved</state>
|
||||
</TriggerOnStateEnter>
|
||||
</Set>
|
||||
|
||||
@@ -100,6 +100,8 @@ define('TMP_CONFIG_FILE', '../tmp-config-itop.php');
|
||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past
|
||||
|
||||
Utils::SpecifyConfigFile(TMP_CONFIG_FILE);
|
||||
|
||||
/**
|
||||
* Main program
|
||||
*/
|
||||
|
||||
@@ -1082,6 +1082,8 @@ function SetupFinished(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $o
|
||||
clearstatcache(); // Make sure we know what we are doing !
|
||||
if (file_exists(FINAL_CONFIG_FILE))
|
||||
{
|
||||
Utils::SpecifyConfigFile(FINAL_CONFIG_FILE);
|
||||
|
||||
// The configuration file already exists
|
||||
if (is_writable(FINAL_CONFIG_FILE))
|
||||
{
|
||||
@@ -1099,6 +1101,8 @@ if (file_exists(FINAL_CONFIG_FILE))
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils::SpecifyConfigFile(TMP_CONFIG_FILE);
|
||||
|
||||
// No configuration file yet
|
||||
// Check that the wizard can write into the root dir to create the configuration file
|
||||
if (!is_writable(dirname(FINAL_CONFIG_FILE)))
|
||||
|
||||
Reference in New Issue
Block a user