Feature #12167: Reports: Enhanced report registration API to provide custom icons...
authorFrancois Suter <francois.suter@typo3.org>
Fri, 16 Oct 2009 07:21:36 +0000 (07:21 +0000)
committerFrancois Suter <francois.suter@typo3.org>
Fri, 16 Oct 2009 07:21:36 +0000 (07:21 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6154 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/reports/mod/index.php
typo3/sysext/reports/mod/mod_styles.css

index 074eb2c..79e7d50 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-10-16  Francois Suter  <francois@typo3.org>
 
        * Cleanup #12245: Reports: Cleaned up API for providers in status report
+       * Feature #12167: Reports: Enhanced report registration API to provide custom icons for reports
 
 2009-10-15  Steffen Kamper  <info@sk-typo3.de>
 
index 548409b..e23aee3 100644 (file)
@@ -215,6 +215,7 @@ class tx_reports_Module extends t3lib_SCbase {
         * @return      string  list of available reports
         */
        protected function indexAction() {
+               $defaultIcon = t3lib_extMgm::extRelPath('reports') . 'mod/moduleicon.gif';
                $content = '<dl class="report-list">';
                $reports = array();
 
@@ -225,7 +226,17 @@ class tx_reports_Module extends t3lib_SCbase {
 
                                $reportTitle = $GLOBALS['LANG']->sL($report['title']);
 
-                               $reportContent  = '<dt><a href="' . $link . '">' . $reportTitle. '</a></dt>';
+                                       // Set default report icon
+                               $icon = $defaultIcon;
+                                       // Check for custom icon
+                               if (!empty($report['icon'])) {
+                                       $absIconPath = t3lib_div::getFileAbsFilename($report['icon']);
+                                               // If the file indeed exists, assemble relative path to it
+                                       if (file_exists($absIconPath)) {
+                                               $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath);
+                                       }
+                               }
+                               $reportContent  = '<dt style="background-image: url(\'' . $icon . '\');"><a href="' . $link . '">' . $reportTitle . '</a></dt>';
                                $reportContent .= '<dd>' . $GLOBALS['LANG']->sL($report['description']) . '</dd>';
 
                                $reports[$reportTitle] = $reportContent;
index 7e76492..9c2a4b6 100644 (file)
@@ -15,7 +15,6 @@ body#ext-reports-mod-index-php {
 .report-list dt {
        font-weight: bold;
        font-size: 11px;
-       background-image: url("moduleicon.gif");
        background-repeat: no-repeat;
        padding: 0px 0px 2px 20px;
 }