Przeglądaj źródła

Customer portal : Added description to bricks. Displayed only in the home tiles.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4080 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 9 lat temu
rodzic
commit
397e15b34b

+ 36 - 0
datamodels/2.x/itop-portal-base/portal/src/entities/abstractbrick.class.inc.php

@@ -45,6 +45,7 @@ abstract class AbstractBrick
 	const DEFAULT_RANK = 1.0;
 	const DEFAULT_PAGE_TEMPLATE_PATH = null;
 	const DEFAULT_TITLE = '';
+	const DEFAULT_DESCRIPTION = null;
 	const DEFAULT_DATA_LOADING = self::ENUM_DATA_LOADING_AUTO;
 	const DEFAULT_ALLOWED_PROFILES_OQL = '';
 	const DEFAULT_DENIED_PROFILES_OQL = '';
@@ -55,6 +56,7 @@ abstract class AbstractBrick
 	protected $fRank;
 	protected $sPageTemplatePath;
 	protected $sTitle;
+	protected $sDescription;
 	protected $sDataLoading;
 	protected $aAllowedProfiles;
 	protected $aDeniedProfiles;
@@ -81,6 +83,7 @@ abstract class AbstractBrick
 		$this->fRank = static::DEFAULT_RANK;
 		$this->sPageTemplatePath = static::DEFAULT_PAGE_TEMPLATE_PATH;
 		$this->sTitle = static::DEFAULT_TITLE;
+		$this->sDescription = static::DEFAULT_DESCRIPTION;
 		$this->sDataLoading = static::DEFAULT_DATA_LOADING;
 		$this->aAllowedProfiles = array();
 		$this->aDeniedProfiles = array();
@@ -149,6 +152,16 @@ abstract class AbstractBrick
 	}
 
 	/**
+	 * Returns the brick description
+	 *
+	 * @return string
+	 */
+	public function GetDescription()
+	{
+		return $this->sDescription;
+	}
+
+	/**
 	 * Returns the brick data loading mode
 	 *
 	 * @return string
@@ -265,6 +278,17 @@ abstract class AbstractBrick
 	}
 
 	/**
+	 * Sets the description of the brick
+	 *
+	 * @param string $sDescription
+	 */
+	public function SetDescription($sDescription)
+	{
+		$this->sDescription = $sDescription;
+		return $this;
+	}
+
+	/**
 	 * Sets the data loading mode of the brick
 	 *
 	 * @param string $sDataLoading
@@ -451,6 +475,15 @@ abstract class AbstractBrick
 	}
 
 	/**
+	 *
+	 * @return boolean
+	 */
+	public function HasDescription()
+	{
+		return ($this->sDescription !== null && $this->sDescription !== '');
+	}
+
+	/**
 	 * Load the brick's data from the xml passed as a ModuleDesignElement.
 	 * This is used to set all the brick attributes at once.
 	 *
@@ -491,6 +524,9 @@ abstract class AbstractBrick
 				case 'title':
 					$this->SetTitle($oBrickSubNode->GetText(static::DEFAULT_TITLE));
 					break;
+				case 'description':
+					$this->SetDescription($oBrickSubNode->GetText(static::DEFAULT_DESCRIPTION));
+					break;
 				case 'data_loading':
 					$this->SetDataLoading($oBrickSubNode->GetText(static::DEFAULT_DATA_LOADING));
 					break;

+ 3 - 1
datamodels/2.x/itop-portal-base/portal/src/views/bricks/tile.html.twig

@@ -28,7 +28,9 @@
 			<div class="tile_decoration"><img src="{{ app['combodo.portal.base.absolute_url'] }}img/icons/{{sIcon}}"	/></div>
 			<div clss="tile_body">
 				<div class="tile_title">{{ brick.GetTitle|dict_s }}</div>
-				<div class="tile_description"></div>
+				{% if brick.HasDescription %}
+					<div class="tile_description">{{ brick.GetDescription }}</div>
+				{% endif %}
 			</div>
 		</a>
 	{% endblock %}