Commit 6e6e17d6046a70b1df1de34c57bfd72ffbf48ef9

Authored by andrew
1 parent 72c2ae0f

Type: Functionality change.

Description:		Added a configurable MARQUEE'd scrolling news to dashboard.
Credit:			This patch was supplied by Stefano Ciancio.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2818 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/dashboard/DashboardNews.inc
@@ -312,10 +312,10 @@ class DashboardNews { @@ -312,10 +312,10 @@ class DashboardNews {
312 //set the current news item primary key 312 //set the current news item primary key
313 $this->iId = $sql->insert_id(); 313 $this->iId = $sql->insert_id();
314 314
315 - if ($this->bActive) {  
316 - // we're setting this entry to active, so set all the others to inactive  
317 - $sql->query("UPDATE $default->news_table SET active=0 WHERE id <> $this->iId");  
318 - } 315 +// if ($this->bActive) {
  316 +// // we're setting this entry to active, so set all the others to inactive
  317 +// $sql->query("UPDATE $default->news_table SET active=0 WHERE id <> $this->iId");
  318 +// }
319 319
320 return true; 320 return true;
321 } 321 }
@@ -345,14 +345,12 @@ class DashboardNews { @@ -345,14 +345,12 @@ class DashboardNews {
345 $result = $sql->query($sQuery); 345 $result = $sql->query($sQuery);
346 if ($result) { 346 if ($result) {
347 if ($this->bActive) { 347 if ($this->bActive) {
348 - // we're setting this entry to active, so set all the others to inactive  
349 - $sql->query("UPDATE $default->news_table SET active=0");  
350 // now set our entry to active 348 // now set our entry to active
351 $sql->query("UPDATE $default->news_table SET active=1 where id=$this->iId"); 349 $sql->query("UPDATE $default->news_table SET active=1 where id=$this->iId");
352 - } else {  
353 - // set this to inactive  
354 - $sql->query("UPDATE $default->news_table SET active=0 where id=$this->iId");  
355 - } 350 + } else {
  351 + // set this to inactive
  352 + $sql->query("UPDATE $default->news_table SET active=0 where id=$this->iId");
  353 + }
356 return true; 354 return true;
357 } 355 }
358 return false; 356 return false;
@@ -477,4 +475,4 @@ class DashboardNews { @@ -477,4 +475,4 @@ class DashboardNews {
477 return ""; 475 return "";
478 } 476 }
479 } 477 }
480 -}  
481 \ No newline at end of file 478 \ No newline at end of file
  479 +}
presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
@@ -228,23 +228,36 @@ function renderDashboardNews() { @@ -228,23 +228,36 @@ function renderDashboardNews() {
228 // retrieve all news items 228 // retrieve all news items
229 $aDashboardNews = DashboardNews::getList("active=1"); 229 $aDashboardNews = DashboardNews::getList("active=1");
230 230
  231 + if ($default->ScrollingNews) {
  232 +
  233 + $sToRender .= "<MARQUEE onmouseover=this.stop() onmouseout=this.start() scrollAmount=1 direction=up width='100%' height='100'>";
231 $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n"; 234 $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n";
232 - // the main news item  
233 - $oMainDashboardNews = $aDashboardNews[0];  
234 - if ($oMainDashboardNews) {  
235 - $sToRender .= "\t\t\t\t<tr><td><strong>" . $oMainDashboardNews->getSynopsis() . "</strong></td></tr>\n";  
236 - $sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getImageLink() . "</td></tr>\n";  
237 - $sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getBodyFragment() . "..... <a href=\"#\" onClick=\"javascript:window.open('" . generateControllerUrl("viewNewsItem", "fNewsID=" . $oMainDashboardNews->getID()) . "', 'newwindow', config='height=200,width=300,left=0,top=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no');return false;\">more</a></td></tr>\n";  
238 - }  
239 -  
240 - // links to old news items  
241 - /*  
242 - for ($i=1; $i<count($aDashboardNews); $i++) {  
243 - $sToRender .= "\t\t\t\t<tr><td>" . generateControllerLink("viewNewsItem", "fNewsID=" . $aDashboardNews[$i]->getID(), $aDashboardNews[$i]->getSynopsis()) . "</td></tr>\n";  
244 - }  
245 - */  
246 - $sToRender .= "\t\t\t</table>\n"; 235 +
  236 + // For each news ...
  237 + foreach($aDashboardNews as $key => $oMainDashboardNews) {
  238 +
  239 + $sToRender .= "\t\t\t\t<tr><td>". $oMainDashboardNews->getImageLink() . "\t<strong><a href=\"#\" onClick=\"javascript:window.open('" . generateControllerUrl("viewNewsItem", "fNewsID=" . $oMainDashboardNews->getID()) . "', 'newwindow', config='height=200,width=300,left=0,top=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no');return false;\">".$oMainDashboardNews->getSynopsis() . "...</strong></a></td></tr>\n";
247 240
  241 + }
  242 +
  243 + $sToRender .= "\t\t\t</table>\n";
  244 + $sToRender .= "</MARQUEE>";
  245 +
  246 + } else {
  247 +
  248 + $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n";
  249 +
  250 + // the main news item
  251 + $oMainDashboardNews = $aDashboardNews[0];
  252 + if ($oMainDashboardNews) {
  253 + $sToRender .= "\t\t\t\t<tr><td><strong>" . $oMainDashboardNews->getSynopsis() . "</strong></td></tr>\n";
  254 + $sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getImageLink() . "</td></tr>\n";
  255 + $sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getBodyFragment() . "..... <a href=\"#\" onClick=\"javascript:window.open('" . generateControllerUrl("viewNewsItem", "fNewsID=" . $oMainDashboardNews->getID()) . "', 'newwindow', config='height=200,width=300,left=0,top=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no');return false;\">more</a></td></tr>\n";
  256 + }
  257 + $sToRender .= "\t\t\t</table>\n";
  258 +
  259 + }
  260 +
248 return $sToRender; 261 return $sToRender;
249 } 262 }
250 263
@@ -324,4 +337,4 @@ function renderNewsItemPage($oDashboardNews) { @@ -324,4 +337,4 @@ function renderNewsItemPage($oDashboardNews) {
324 337
325 return $sToRender; 338 return $sToRender;
326 } 339 }
327 -?>  
328 \ No newline at end of file 340 \ No newline at end of file
  341 +?>