1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-28 18:30:53 +02:00

e107 News Infopanel now includes latest plugins/themes. Online panel now displays user language when multi-language tables are in use.

This commit is contained in:
Cameron
2016-01-14 08:28:17 -08:00
parent 796f5fa95c
commit 60be9aa37f
4 changed files with 123 additions and 13 deletions

View File

@@ -33,6 +33,65 @@ if(ADMIN && defset('e_ADMIN_UI') && varset($_POST['mode']) == 'sef' && !empty($_
exit;
}
if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons' )
{
$type = ($_GET['type'] == 'plugin') ? 'plugin' : 'theme';
$tag = 'infopanel_'.$type;
$cache = e107::getCache();
$cache->setMD5('_');
if($text = $cache->retrieve($tag,180,true)) // check every 3 hours.
{
echo $text;
if(e_DEBUG === true)
{
echo "<span class='label label-warning'>Cached</span>";
}
exit;
}
if($data = e107::getXml()->getRemoteFile('http://e107.org/feed/?limit=3&type='.$type,3))
{
$rows = e107::getXml()->parseXml($data, 'advanced');
// print_a($rows);
// exit;
$link = ($type == 'plugin') ? e_ADMIN."plugin.php?mode=online" : e_ADMIN."theme.php?mode=online";
$text = "<div style='margin-top:10px'>";
foreach($rows[$type] as $val)
{
$meta = $val['@attributes'];
$img = ($type == 'theme') ? $meta['thumbnail'] : $meta['icon'];
$text .= '<div class="media">';
$text .= '<div class="media-left">
<a href="'.$link.'">
<img class="media-object img-rounded" src="'.$img.'" style="width:100px">
</a>
</div>
<div class="media-body">
<h4 class="media-heading"><a href="'.$link.'">'.$meta['name'].' v'.$meta['version'].'</a> <small>&mdash; '.$meta['author'].'</small></h4>
'.$val['description'].'
</div>';
$text .= '</div>';
}
$text .= "</div>";
$text .= "<div class='right'><a href='".$link."'>".LAN_MORE."</a></div>";
echo $text;
$cache->set($tag, $text, true);
}
exit;
}
### Language files
e107::coreLan('header', true);
e107::coreLan('footer', true);

View File

@@ -20,6 +20,10 @@ if (!defined('e107_INIT'))
define('ADMINFEED', 'http://e107.org/adminfeed');
define('ADMINFEEDMORE', 'http://e107.org/blog');
class adminstyle_infopanel
{
@@ -33,11 +37,16 @@ class adminstyle_infopanel
jQuery(function($){
$('#e-adminfeed').rssfeed('".ADMINFEED."', {
$('#e-adminfeed').rssfeed('".ADMINFEED."', {
limit: 3,
header: false,
linktarget: '_blank'
});
$('#e-adminfeed-plugin').load('".e_ADMIN."admin.php?mode=addons&type=plugin');
$('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme');
});
";
@@ -201,8 +210,13 @@ class adminstyle_infopanel
// ------------------------------- e107 News --------------------------------
$text2 = $ns->tablerender("e107 News","<div id='e-adminfeed'></div><div class='right'><a rel='external' href='".ADMINFEEDMORE."'>".LAN_MORE."</a></div>","core-infopanel_news",true);
$newsTabs = array();
$newsTabs['core'] = array('caption'=>'General','text'=>"<div id='e-adminfeed' style='min-height:300px'></div><div class='right'><a rel='external' href='".ADMINFEEDMORE."'>".LAN_MORE."</a></div>");
$newsTabs['plugin'] = array('caption'=>'Plugins','text'=>"<div id='e-adminfeed-plugin'></div>");
$newsTabs['theme'] = array('caption'=>'Themes','text'=>"<div id='e-adminfeed-theme'></div>");
$text2 = $ns->tablerender("Latest e107 News",e107::getForm()->tabs($newsTabs, array('active'=>'core')),"core-infopanel_news",true);
@@ -374,6 +388,7 @@ class adminstyle_infopanel
$ol = e107::getOnline();
$tp = e107::getParser();
$multilan = e107::getPref('multilanguage');
$panelOnline = "
@@ -383,7 +398,15 @@ class adminstyle_infopanel
<col style='width: 25%' />
<col style='width: 10%' />
<col style='width: 40%' />
<col style='width: auto' />
<col style='width: auto' />";
$panelOnline .= (!empty($multilan)) ? "<col style='width: auto' />" : "";
// TODO LAN
$panelOnline .= "
</colgroup>
<thead>
<tr class='first'>
@@ -391,10 +414,16 @@ class adminstyle_infopanel
<th>Username</th>
<th>IP</th>
<th>Page</th>
<th class='center'>Agent</th>
<th class='center'>Agent</th>";
$panelOnline .= (!empty($multilan)) ? "<th class='center'>Lang.</th>" : "";
$panelOnline .= "
</tr>
</thead>
<tbody>";
<tbody>";
$online = $ol->userList() + $ol->guestList();
@@ -403,8 +432,10 @@ class adminstyle_infopanel
return count($online);
}
// echo "Users: ".print_a($online);
// echo "Users: ".print_a($online);
$lng = e107::getLanguage();
foreach ($online as $val)
{
$panelOnline .= "
@@ -413,7 +444,12 @@ class adminstyle_infopanel
<td>".$this->renderOnlineName($val['online_user_id'])."</td>
<td>".e107::getIPHandler()->ipDecode($val['user_ip'])."</td>
<td><a class='e-tip' href='".$val['user_location']."' title='".$val['user_location']."'>".$tp->html_truncate(basename($val['user_location']),50,"...")."</a></td>
<td class='center'><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>
<td class='center'><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>";
$panelOnline .= (!empty($multilan)) ? "<td class='center'><a class='e-tip' href='#' title=\"".$lng->convert($val['user_language'])."\">".$val['user_language']."</a></td>" : "";
$panelOnline .= "
</tr>
";
}

View File

@@ -208,7 +208,7 @@ class e_form
*/
function tabs($array,$options = array())
{
$initTab = varset($options['active'],false);
$text ='
<!-- Nav tabs -->
<ul class="nav nav-tabs">';
@@ -216,18 +216,25 @@ class e_form
$c = 0;
foreach($array as $key=>$tab)
{
if($c == 0 & $initTab == false)
{
$initTab = $key;
}
if(is_numeric($key))
{
$key = 'tab-'.$this->name2id($tab['caption']);
}
$active = ($c == 0) ? ' class="active"' : '';
$active = ($key ==$initTab) ? ' class="active"' : '';
$text .= '<li'.$active.'><a href="#'.$key.'" data-toggle="tab">'.$tab['caption'].'</a></li>';
$c++;
}
$text .= '</ul>';
$initTab = varset($options['active'],false);
$text .= '
<!-- Tab panes -->
<div class="tab-content">';
@@ -235,12 +242,19 @@ class e_form
$c=0;
foreach($array as $key=>$tab)
{
if(is_numeric($key))
{
$key = 'tab-'.$this->name2id($tab['caption']);
}
if($c == 0 & $initTab == false)
{
$initTab = $key;
}
$active = ($c == 0) ? ' active' : '';
$active = ($key == $initTab) ? ' active' : '';
$text .= '<div class="tab-pane'.$active.'" id="'.$key.'">'.$tab['text'].'</div>';
$c++;
}

View File

@@ -265,7 +265,8 @@ class e_online
'user_pagecount' => $row['online_pagecount'],
'user_active' => $row['online_active'],
'user_image' => vartrue($row['user_image'],false),
'online_user_id' => $row['online_user_id']
'online_user_id' => $row['online_user_id'],
'user_language' => $row['online_language']
);
if($row['online_user_id'] != 0 )