diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php
index 2989eea2d..b71e7cbda 100644
--- a/core/attributedef.class.inc.php
+++ b/core/attributedef.class.inc.php
@@ -1879,7 +1879,7 @@ class AttributeCaseLog extends AttributeLongText
*
* @package iTopORM
*/
-class AttributeHTML extends AttributeText
+class AttributeHTML extends AttributeLongText
{
public function GetEditClass() {return "HTML";}
@@ -2371,6 +2371,7 @@ class AttributeDateTime extends AttributeDBField
default:
$oNewCondition = parent::GetSmartConditionExpression($sSearchText, $oField, $aParams);
+
}
return $oNewCondition;
@@ -3353,16 +3354,26 @@ class AttributeOneWayPassword extends AttributeDefinition
}
// Indexed array having two dimensions
-class AttributeTable extends AttributeText
+class AttributeTable extends AttributeDBField
{
- public function GetEditClass() {return "Text";}
- protected function GetSQLCol() {return "TEXT";}
+ public function GetEditClass() {return "Table";}
+ protected function GetSQLCol() {return "LONGTEXT";}
public function GetMaxSize()
{
return null;
}
+ public function GetNullValue()
+ {
+ return array();
+ }
+
+ public function IsNull($proposedValue)
+ {
+ return (count($proposedValue) == 0);
+ }
+
// Facilitate things: allow the user to Set the value from a string
public function MakeRealValue($proposedValue, $oHostObj)
{
@@ -3425,13 +3436,39 @@ class AttributeTable extends AttributeText
$sRes .= "";
return $sRes;
}
+
+ public function GetAsCSV($sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null)
+ {
+ // Not implemented
+ return '';
+ }
+
+ public function GetAsXML($value, $oHostObject = null)
+ {
+ if (count($value) == 0)
+ {
+ return "";
+ }
+
+ $sRes = "";
+ foreach($value as $iRow => $aRawData)
+ {
+ $sRes .= "";
+ foreach ($aRawData as $iCol => $cell)
+ {
+ $sCell = Str::pure2xml((string)$cell);
+ $sRes .= "| $sCell | ";
+ }
+ $sRes .= "
";
+ }
+ return $sRes;
+ }
}
// The PHP value is a hash array, it is stored as a TEXT column
class AttributePropertySet extends AttributeTable
{
- public function GetEditClass() {return "Text";}
- protected function GetSQLCol() {return "TEXT";}
+ public function GetEditClass() {return "PropertySet";}
// Facilitate things: allow the user to Set the value from a string
public function MakeRealValue($proposedValue, $oHostObj)
@@ -3458,6 +3495,10 @@ class AttributePropertySet extends AttributeTable
$sRes .= "
";
foreach($value as $sProperty => $sValue)
{
+ if ($sProperty == 'auth_pwd')
+ {
+ $sValue = '*****';
+ }
$sRes .= "";
$sCell = str_replace("\n", "
\n", Str::pure2html((string)$sValue));
$sRes .= "$sProperty | $sCell | ";
@@ -3467,6 +3508,53 @@ class AttributePropertySet extends AttributeTable
$sRes .= "";
return $sRes;
}
+
+ public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null)
+ {
+ if (count($value) == 0)
+ {
+ return "";
+ }
+
+ $aRes = array();
+ foreach($value as $sProperty => $sValue)
+ {
+ if ($sProperty == 'auth_pwd')
+ {
+ $sValue = '*****';
+ }
+ $sFrom = array(',', '=');
+ $sTo = array('\,', '\=');
+ $aRes[] = $sProperty.'='.str_replace($sFrom, $sTo, (string)$sValue);
+ }
+ $sRaw = implode(',', $aRes);
+
+ $sFrom = array("\r\n", $sTextQualifier);
+ $sTo = array("\n", $sTextQualifier.$sTextQualifier);
+ $sEscaped = str_replace($sFrom, $sTo, $sRaw);
+ return $sTextQualifier.$sEscaped.$sTextQualifier;
+ }
+
+ public function GetAsXML($value, $oHostObject = null)
+ {
+ if (count($value) == 0)
+ {
+ return "";
+ }
+
+ $sRes = "";
+ foreach($value as $sProperty => $sValue)
+ {
+ if ($sProperty == 'auth_pwd')
+ {
+ $sValue = '*****';
+ }
+ $sRes .= "";
+ $sRes .= Str::pure2xml((string)$sValue);
+ $sRes .= "";
+ }
+ return $sRes;
+ }
}
/**
diff --git a/core/dbobject.class.php b/core/dbobject.class.php
index 6a8c15357..6f404009a 100644
--- a/core/dbobject.class.php
+++ b/core/dbobject.class.php
@@ -1719,7 +1719,7 @@ abstract class DBObject
// #@# Note: This has been proven to be quite slow, this can slow down bulk load
$sAsHtml = $this->GetAsHtml($sAttCode);
$aScalarArgs[$sArgName.'->html('.$sAttCode.')'] = $sAsHtml;
- $aScalarArgs[$sArgName.'->label('.$sAttCode.')'] = strip_tags($sAsHtml);
+ $aScalarArgs[$sArgName.'->label('.$sAttCode.')'] = $this->GetEditValue($sAttCode); // "Nice" display value, but without HTML tags and entities
}
// Do something for case logs... quick N' dirty...
if ($aScalarArgs[$sArgName.'->'.$sAttCode] instanceof ormCaseLog)
diff --git a/core/event.class.inc.php b/core/event.class.inc.php
index 7463d6336..19f6acaf1 100644
--- a/core/event.class.inc.php
+++ b/core/event.class.inc.php
@@ -174,7 +174,7 @@ class EventNotificationEmail extends EventNotification
MetaModel::Init_AddAttribute(new AttributeText("bcc", array("allowed_values"=>null, "sql"=>"bcc", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
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 AttributeText("body", array("allowed_values"=>null, "sql"=>"body", "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())));
// 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