Merge pull request #153 from BNoiZe/master
Initial version of newsfeed in admin dashboard, needs a setting to enable/disable
This commit is contained in:
46
lib/ajax.php
Normal file
46
lib/ajax.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of the Froxlor project.
|
||||||
|
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||||
|
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the COPYING
|
||||||
|
* file that was distributed with this source code. You can also view the
|
||||||
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||||
|
*
|
||||||
|
* @copyright (c) the authors
|
||||||
|
* @author Roman Schmerold <bnoize@froxlor.org>
|
||||||
|
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||||
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||||
|
* @package AJAX
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(isset($_POST['action'])) {
|
||||||
|
$action = $_POST['action'];
|
||||||
|
} elseif(isset($_GET['action'])) {
|
||||||
|
$action = $_GET['action'];
|
||||||
|
} else {
|
||||||
|
$action = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == "newsfeed") {
|
||||||
|
$news = simplexml_load_file('http://froxlor.org/feed.rss.php', null, LIBXML_NOCDATA);
|
||||||
|
|
||||||
|
if ($news !== false) {
|
||||||
|
for ($i = 0; $i < 3; $i++) {
|
||||||
|
$item = $news->channel->item[$i];
|
||||||
|
|
||||||
|
$title = (string)$item->title;
|
||||||
|
$link = (string)$item->link;
|
||||||
|
$content = preg_replace("/[\r\n]+/", "", strip_tags($item->description));
|
||||||
|
|
||||||
|
echo "<div class=\"newsitem\"><a href=\"" . $link . "\" target=\"_blank\"><b>" . $title . "</b>" . $content . "</a></div>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "No action set.";
|
||||||
|
}
|
||||||
3
templates/Sparkle/admin/index/index.tpl
vendored
3
templates/Sparkle/admin/index/index.tpl
vendored
@@ -4,6 +4,9 @@ $header
|
|||||||
<img src="templates/{$theme}/assets/img/icons/domains_big.png" alt="" />
|
<img src="templates/{$theme}/assets/img/icons/domains_big.png" alt="" />
|
||||||
{$lng['panel']['dashboard']}
|
{$lng['panel']['dashboard']}
|
||||||
</h2>
|
</h2>
|
||||||
|
<div class="dboarditemfull bradius" id="newsfeed" style="display: none"></div>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
<div class="canvasitems" id="statsbox">
|
<div class="canvasitems" id="statsbox">
|
||||||
<div class="canvasbox">
|
<div class="canvasbox">
|
||||||
<input type="hidden" id="customers" class="circular" data-used="{$overview['number_customers']}" data-available="{$userinfo['customers']}">
|
<input type="hidden" id="customers" class="circular" data-used="{$overview['number_customers']}" data-available="{$userinfo['customers']}">
|
||||||
|
|||||||
25
templates/Sparkle/assets/css/main.css
vendored
25
templates/Sparkle/assets/css/main.css
vendored
@@ -490,6 +490,7 @@ nav {
|
|||||||
float: left;
|
float: left;
|
||||||
width:230px;
|
width:230px;
|
||||||
background-color:#f7f8fa;
|
background-color:#f7f8fa;
|
||||||
|
min-height: 500px;
|
||||||
}
|
}
|
||||||
nav div:first-child {
|
nav div:first-child {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -939,3 +940,27 @@ label.nobr {
|
|||||||
.canvasbox canvas {
|
.canvasbox canvas {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NEWSFEED */
|
||||||
|
.newsitem {
|
||||||
|
border-bottom: 1px solid #f1f2f3;
|
||||||
|
padding: 6px 10px 8px 10px;
|
||||||
|
height: 16px;
|
||||||
|
line-height: 20px;
|
||||||
|
margin: 0 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.newsitem a {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.newsitem a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.newsitem a:hover b {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.newsitem b {
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|||||||
8
templates/Sparkle/assets/js/main.js
vendored
8
templates/Sparkle/assets/js/main.js
vendored
@@ -32,6 +32,14 @@ $(document).ready(function() {
|
|||||||
$('#maincontent').height(snheight - 60);
|
$('#maincontent').height(snheight - 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load Newsfeed
|
||||||
|
var ajax_load = "<div id='newsitem'>Loading newsfeed...</div>";
|
||||||
|
$("#newsfeed").html(ajax_load).load("lib/ajax.php?action=newsfeed", function() {
|
||||||
|
if ($("#newsfeed").html() != "") {
|
||||||
|
$("#newsfeed").slideDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// this is necessary for the special setting feature (ref #1010)
|
// this is necessary for the special setting feature (ref #1010)
|
||||||
$.getQueryVariable = function(key) {
|
$.getQueryVariable = function(key) {
|
||||||
var urlParams = decodeURI( window.location.search.substring(1) );
|
var urlParams = decodeURI( window.location.search.substring(1) );
|
||||||
|
|||||||
Reference in New Issue
Block a user