Code

Updated dashbaord
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Jun 2010 13:27:30 +0000 (13:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Jun 2010 13:27:30 +0000 (13:27 +0000)
-Updated feed provider

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18885 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/dashBoard/dbInformation/class_dbInformation.inc

index 707447cbbb6e97d3a93940c3cb64b34aae21dbcd..e393a3535f6309f2e7b43f8390c6e1af9b5c6e39 100644 (file)
@@ -9,37 +9,54 @@ class dbInformation extends plugin
         // Construct the plugin list.
         $this->feedList = new sortableListing();
         $this->feedList->setDeleteable(false);
-        $this->feedList->setEditable(false);
-        #$this->feedList->setColspecs(array('130px','*'));
-        #$this->feedList->setHeader(array(_("Date"),_("Description")));
+        $this->feedList->setEditable(true);
         $this->feedList->setWidth("100%");
-        #$this->feedList->setDefaultSortColumn(0);
         $this->feedList->setHeight("200px");
         $this->feedList->setAcl("rwcdm");
     }
 
     function execute()
     {
-        $smarty = get_smarty();
+        // Act on clicks on the feed list.
+        $linkOpener = "";
+        $action = $this->feedList->getAction();
+        if(isset($action['action']) && $action['action'] == 'edit'){
+            $data = $this->feedList->getData($action['targets'][0]);
+            if(isset($data['link']) && !empty($data['link'])){
+                $linkOpener = '
+                    <script language="JavaScript" type="text/javascript">
+                        window.open("'.$data['link'].'");
+                    </script>';
+            }
+        }
+    
+        // Read Feeds and sort the results 
         $feeds = rssReader::feadToArray(array(
+                    'http://www.uweschwanz.com/de/rss/',
+                    'http://www.aviationpower.de/rss_de.php',
                     'http://www.computerbild.de/rssfeed_2261.html?node=10',
                     'http://www.charts-portal.de/games/Computerspiele.xml'));
         $feeds = rssReader::sortFeedResultBy($feeds, 'timestamp');
+
+        // Append the results to the list.
         $data = $lData = array();
         foreach($feeds as $key => $feed){
             $data[$key] = $feed;
-            $lData[$key] = array('data'=> array($feed['title']));
+            $lData[$key] = array('data'=> array(htmlentities($feed['title'],ENT_QUOTES,'UTF-8')));
         }
-
         $this->feedList->setListData($data, $lData);
         $this->feedList->update();
+
+        // Generate the HTML content
+        $smarty = get_smarty();
         $smarty->assign('feedList', $this->feedList->render());
-        return($smarty->fetch(get_template_path('dbInformation/contents.tpl', TRUE)));
+        return($linkOpener.$smarty->fetch(get_template_path('dbInformation/contents.tpl', TRUE)));
     }
 
     function save_object()
     {
         parent::save_object();
+        $this->feedList->save_object();
     }
 
     function save()