mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Record the list of attachments (in EventNotificationEmail) + prerequisite to email-reply
SVN:trunk[2413]
This commit is contained in:
@@ -548,6 +548,7 @@ EOF
|
||||
}
|
||||
$sHtml .= "</script>\n";
|
||||
}
|
||||
$this->output_dict_entries();
|
||||
}
|
||||
|
||||
if (count($this->a_styles)>0)
|
||||
|
||||
@@ -57,6 +57,7 @@ class WebPage implements Page
|
||||
protected $s_content;
|
||||
protected $s_deferred_content;
|
||||
protected $a_scripts;
|
||||
protected $a_dict_entries;
|
||||
protected $a_styles;
|
||||
protected $a_include_scripts;
|
||||
protected $a_include_stylesheets;
|
||||
@@ -76,6 +77,7 @@ class WebPage implements Page
|
||||
$this->s_content = "";
|
||||
$this->s_deferred_content = '';
|
||||
$this->a_scripts = array();
|
||||
$this->a_dict_entries = array();
|
||||
$this->a_styles = array();
|
||||
$this->a_linked_scripts = array();
|
||||
$this->a_linked_stylesheets = array();
|
||||
@@ -231,6 +233,16 @@ class WebPage implements Page
|
||||
{
|
||||
// Do nothing silently... this is not supported by this type of page...
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a dictionary entry for the Javascript side
|
||||
*/
|
||||
public function add_dict_entry($s_entryId)
|
||||
{
|
||||
$this->a_dict_entries[$s_entryId] = Dict::S($s_entryId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add some CSS definitions to the header of the page
|
||||
*/
|
||||
@@ -438,6 +450,7 @@ class WebPage implements Page
|
||||
}
|
||||
echo "</script>\n";
|
||||
}
|
||||
$this->output_dict_entries();
|
||||
foreach($this->a_linked_stylesheets as $a_stylesheet)
|
||||
{
|
||||
if ($a_stylesheet['condition'] != "")
|
||||
@@ -655,5 +668,30 @@ class WebPage implements Page
|
||||
|
||||
return $sHtml;
|
||||
}
|
||||
|
||||
protected function output_dict_entries()
|
||||
{
|
||||
if (count($this->a_dict_entries)>0)
|
||||
{
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
echo "var Dict = {};\n";
|
||||
echo "Dict._entries = {};\n";
|
||||
echo "Dict.S = function(sEntry) {\n";
|
||||
echo " if (sEntry in Dict._entries)\n";
|
||||
echo " {\n";
|
||||
echo " return Dict._entries[sEntry];\n";
|
||||
echo " }\n";
|
||||
echo " else\n";
|
||||
echo " {\n";
|
||||
echo " return sEntry;\n";
|
||||
echo " }\n";
|
||||
echo "};\n";
|
||||
foreach($this->a_dict_entries as $s_entry => $s_value)
|
||||
{
|
||||
echo "Dict._entries['$s_entry'] = '".addslashes($s_value)."';\n";
|
||||
}
|
||||
echo "</script>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -359,10 +359,13 @@ class ActionEmail extends ActionNotification
|
||||
|
||||
if (isset($aContextArgs['attachments']))
|
||||
{
|
||||
$aAttachmentReport = array();
|
||||
foreach($aContextArgs['attachments'] as $oDocument)
|
||||
{
|
||||
$oEmail->AddAttachment($oDocument->GetData(), $oDocument->GetFileName(), $oDocument->GetMimeType());
|
||||
$aAttachmentReport[] = array($oDocument->GetFileName(), $oDocument->GetMimeType(), strlen($oDocument->GetData()));
|
||||
}
|
||||
$oLog->Set('attachments', $aAttachmentReport);
|
||||
}
|
||||
|
||||
if (empty($this->m_aMailErrors))
|
||||
|
||||
@@ -4186,7 +4186,11 @@ class AttributeTable extends AttributeDBField
|
||||
// Facilitate things: allow the user to Set the value from a string
|
||||
public function MakeRealValue($proposedValue, $oHostObj)
|
||||
{
|
||||
if (!is_array($proposedValue))
|
||||
if (is_null($proposedValue))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
else if (!is_array($proposedValue))
|
||||
{
|
||||
return array(0 => array(0 => $proposedValue));
|
||||
}
|
||||
|
||||
@@ -176,10 +176,11 @@ class EventNotificationEmail extends EventNotification
|
||||
MetaModel::Init_AddAttribute(new AttributeText("from", array("allowed_values"=>null, "sql"=>"from", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeText("subject", array("allowed_values"=>null, "sql"=>"subject", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeHTML("body", array("allowed_values"=>null, "sql"=>"body", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeTable("attachments", array("allowed_values"=>null, "sql"=>"attachments", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
|
||||
// Display lists
|
||||
MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'message', 'trigger_id', 'action_id', 'object_id', 'to', 'cc', 'bcc', 'from', 'subject', 'body')); // Attributes to be displayed for the complete details
|
||||
MetaModel::Init_SetZListItems('list', array('date', 'message', 'to', 'subject')); // Attributes to be displayed for a list
|
||||
MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'message', 'trigger_id', 'action_id', 'object_id', 'to', 'cc', 'bcc', 'from', 'subject', 'body', 'attachments')); // Attributes to be displayed for the complete details
|
||||
MetaModel::Init_SetZListItems('list', array('date', 'message', 'to', 'subject', 'attachments')); // Attributes to be displayed for a list
|
||||
|
||||
// Search criteria
|
||||
// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
|
||||
|
||||
@@ -325,6 +325,8 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Class:EventNotificationEmail/Attribute:subject+' => 'Subject',
|
||||
'Class:EventNotificationEmail/Attribute:body' => 'Body',
|
||||
'Class:EventNotificationEmail/Attribute:body+' => 'Body',
|
||||
'Class:EventNotificationEmail/Attribute:attachments' => 'Attachments',
|
||||
'Class:EventNotificationEmail/Attribute:attachments+' => '',
|
||||
));
|
||||
|
||||
//
|
||||
|
||||
@@ -169,6 +169,8 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'Class:EventNotificationEmail/Attribute:subject+' => '',
|
||||
'Class:EventNotificationEmail/Attribute:body' => 'Message',
|
||||
'Class:EventNotificationEmail/Attribute:body+' => '',
|
||||
'Class:EventNotificationEmail/Attribute:attachments' => 'Pièces jointes',
|
||||
'Class:EventNotificationEmail/Attribute:attachments+' => '',
|
||||
'Class:EventIssue' => 'Erreur',
|
||||
'Class:EventIssue+' => '',
|
||||
'Class:EventIssue/Attribute:issue' => 'Erreur',
|
||||
|
||||
Reference in New Issue
Block a user