Browse Source

(Partial) fix for Trac #285: turn email fields into click-able mailto: hyperlinks.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@915 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 năm trước cách đây
mục cha
commit
a32437a13c
4 tập tin đã thay đổi với 22 bổ sung1 xóa
  1. 7 0
      core/attributedef.class.inc.php
  2. 2 1
      core/dbobject.class.php
  3. 13 0
      css/light-grey.css
  4. BIN
      images/mail.png

+ 7 - 0
core/attributedef.class.inc.php

@@ -359,6 +359,7 @@ class AttributeLinkedSet extends AttributeDefinition
 	{
 		return "ERROR: LIST OF OBJECTS";
 	}
+	public function DuplicatesAllowed() {return false;} // No duplicates for 1:n links, never
 }
 
 /**
@@ -375,6 +376,7 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet
 	public function IsIndirect() {return true;} 
 	public function GetExtKeyToRemote() { return $this->Get('ext_key_to_remote'); }
 	public function GetEditClass() {return "LinkedSet";}
+	public function DuplicatesAllowed() {$bRet = $this->GetOptional("duplicates", false); echo "<p>Dups: $bRet</p>"; return $bRet;} // The same object may be linked several times... or not...
 }
 
 /**
@@ -1086,6 +1088,11 @@ class AttributeEmailAddress extends AttributeString
 	{
 		return "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";
 	}
+
+	public function GetAsHTML($sValue)
+	{
+		return '<a class="mailto" href="mailto:'.$sValue.'">'.parent::GetAsHTML($sValue).'</a>';
+	}
 }
 
 /**

+ 2 - 1
core/dbobject.class.php

@@ -400,7 +400,8 @@ abstract class DBObject
 			$aAvailableFields = array();
 			foreach ($aExtKeyFriends as $sDispAttCode => $oExtField)
 			{
-				$aAvailableFields[$oExtField->GetExtAttCode()] = $oExtField->GetAsHTML($this->Get($oExtField->GetCode()));
+//				$aAvailableFields[$oExtField->GetExtAttCode()] = $oExtField->GetAsHTML($this->Get($oExtField->GetCode()));
+				$aAvailableFields[$oExtField->GetExtAttCode()] = $this->Get($oExtField->GetCode());
 			}
 
 			$sTargetClass = $oAtt->GetTargetClass(EXTKEY_ABSOLUTE);

+ 13 - 0
css/light-grey.css

@@ -172,6 +172,19 @@ td a.no-arrow:hover {
 	padding-left:0px;
 	background: inherit;
 }
+td a.mailto, td a.mailto:visited {
+	text-decoration:none;
+	color:#000000;
+	padding-left:20px;
+	background: url(../images/mail.png) no-repeat left;
+}
+td a.mailto:hover {
+	text-decoration:underline;
+	color:#EB8F00;
+	padding-left:20px;
+	background: url(../images/mail.png) no-repeat left;
+}
+
 a.small_action {
     font-family: Tahoma, Verdana, Arial, Helvetica;
     font-size: 8pt;

BIN
images/mail.png