1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Admin -> Docs page cleanup. AdminUI: Fix for empty navigation box under some circumstances.

This commit is contained in:
Cameron 2015-09-06 11:00:07 -07:00
parent e4872386c0
commit 388024dc41
4 changed files with 186 additions and 18 deletions

View File

@ -20,25 +20,188 @@ if (!ADMIN) {
exit;
}
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
e107::lan('core','docs',true);
define('DOC_PATH', e_DOCS.e_LANGUAGE.'/');
define('DOC_PATH_ALT', e_DOCS.'English/');
e107::css('inline', 'div.qitem { margin-top:20px }
div.aitem { padding:10px 15px; }
');
class docs_admin extends e_admin_dispatcher
{
protected $modes = array(
'main' => array(
'controller' => 'docs_ui',
'path' => null,
'ui' => 'docs_form_ui',
'uipath' => null
),
);
protected $adminMenu = array(
// 'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
// 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
// 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
);
protected $adminMenuAliases = array(
'main/edit' => 'main/list'
);
protected $menuTitle = LAN_DOCS;
public static $helpList = array();
public static function getDocs()
{
return self::$helpList;
}
function init()
{
$fl = e107::getFile();
$helplist_all = $fl->get_files(DOC_PATH_ALT);
if(!is_dir(DOC_PATH) || DOC_PATH == DOC_PATH_ALT)
{
$helplist = $helplist_all;
}
else
{
$helplist = $fl->get_files(DOC_PATH);
}
self::$helpList = $helplist;
foreach($helplist as $key=>$helpdata)
{
$id = 'doc-'.$key;
$k = 'main/'.$id;
// $text_h .= "
// <div class='qitem'>".E_16_DOCS." <a href='#{$id}' class='scroll-to'>".str_replace("_", " ", $helpdata['fname'])."</a></div>
// ";
$this->adminMenu[$k] = array('caption'=> str_replace("_", " ", $helpdata['fname']), 'perm' => false, 'uri'=>"#".$id );
}
}
}
class docs_ui extends e_admin_ui
{
public function Doc0Page()
{
$helplist = docs_admin::getDocs();
$text = '';
$iconQ = e107::getParser()->toGlyph('fa-question-circle');
$iconA = " ";
foreach($helplist as $key=>$helpdata)
{
$filename = DOC_PATH.$helpdata['fname'];
$filename_alt = DOC_PATH_ALT.vartrue($helpdata['fname']);
if(is_readable($filename))
{
$tmp = file_get_contents($filename);
}
else
{
$tmp = file_get_contents($filename_alt);
}
$tmp = preg_replace('/Q\>(.*?)A>/si', "###QSTART###<div class='qitem'>".$iconQ."\\1</div>###QEND###", $tmp);
$tmp = preg_replace('/###QEND###(.*?)###QSTART###/si', "<div class='aitem'>".$iconA."\\1</div>", $tmp);
$tmp = str_replace(array('###QSTART###', '###QEND###'), array('', "<div class='aitem'>".$iconA), $tmp)."</div>";
$id = 'doc-'.$key;
$display = ($key === 0) ? "" : "style='display:none'";
$text .= "
<div class='docs-item' id='{$id}' {$display}>
<h4>".str_replace("_", " ", $helpdata['fname'])."</h4>
{$tmp}
</div>";
// <div class='gotop'><a href='#docs-list' class='scroll-to'>".LAN_DOCS_GOTOP."</a></div>
}
return $text;
}
}
class docs_form_ui extends e_admin_form_ui
{
}
new docs_admin();
require_once(e_ADMIN."auth.php");
$data = e107::getAdminUI()->runPage('raw');
echo $data[1]; // just to remove the title.
require_once(e_ADMIN."footer.php");
exit;
/*
$e_sub_cat = 'docs';
require_once("auth.php");
require_once (e_HANDLER.'file_class.php');
$fl = new e_file();
$doc_fpath = e_DOCS.e_LANGUAGE.'/';
$doc_fpath_alt = e_DOCS.'English/';
$helplist_all = $fl->get_files($doc_fpath_alt);
if(!is_dir($doc_fpath) || $doc_fpath == $doc_fpath_alt)
$helplist_all = $fl->get_files(DOC_PATH_ALT);
if(!is_dir(DOC_PATH) || DOC_PATH == DOC_PATH_ALT)
{
$helplist = $helplist_all;
}
else
{
$helplist = $fl->get_files($doc_fpath);
$helplist = $fl->get_files(DOC_PATH);
}
//Titles in Admin Area are requested by the community
@ -46,8 +209,8 @@ define('e_PAGETITLE', LAN_DOCS);
if (e_QUERY) {
$i = intval(e_QUERY) - 1;
$filename = $doc_fpath.$helplist[$i]['fname'];
$filename_alt = $doc_fpath_alt.$helplist[$i]['fname'];
$filename = DOC_PATH.$helplist[$i]['fname'];
$filename_alt = DOC_PATH_ALT.$helplist[$i]['fname'];
if(is_readable($filename))
$text = file_get_contents($filename);
@ -64,17 +227,17 @@ if (e_QUERY) {
exit;
}
/*
* NEW 0.8
* Show All
*/
//NEW 0.8
// Show All
$text = '';
$text_h = '';
foreach ($helplist as $key => $helpdata)
{
$filename = $doc_fpath.$helpdata['fname'];
$filename_alt = $doc_fpath_alt.vartrue($$helpdata['fname']);
$filename = DOC_PATH.$helpdata['fname'];
$filename_alt = DOC_PATH_ALT.vartrue($$helpdata['fname']);
if(is_readable($filename))
$tmp = file_get_contents($filename);
@ -99,6 +262,10 @@ foreach ($helplist as $key => $helpdata)
}
$text_h = "<div id='docs-list'><h4>".LAN_DOCS_SECTIONS."</h4>".$text_h."</div>";
$text = $text_h.$text;
@ -109,4 +276,5 @@ $text .= "
$ns->tablerender(LAN_DOCS, $text, 'docs');
require_once("footer.php");
*/
?>

View File

@ -3,7 +3,7 @@ Q> What are these user-classes I keep seeing? What are they for?
A> User classes restrict access to certain areas or functions of your site. If you define a class and then add certain users to it, you can choose to make things visible to only the users in that class.
For example, there is a class already created by default when you install e107 called PRIVATEFORUM. Adding users to this class then creating a forum under that class will make only the users in that class able to access that forum. You can restrict other areas and functions by class, like news items, links, downloads, etc.
Q> What does the 'class parent' field do?
A> In 0.8, you can set a 'class hierarchy', where users in a certain class also have the rights of the parent class. If you don't want this, just set the parent to 'Everyone'
A> In 2.x, you can set a 'class hierarchy', where users in a certain class also have the rights of the parent class. If you don't want this, just set the parent to 'Everyone'
Q> I want new users to start with membership of certain classes.
A> You can now set initial class membership through the 'Userclass' menu. You can also determine whether this membership is in force immediately they sign up, or whether it is added when their membership is verified.

View File

@ -1479,7 +1479,7 @@ class e_admin_dispatcher
foreach($this->adminMenu as $key => $val)
{
if(!empty($val['perm']) && !getperms($val['perm']))
if(isset($val['perm']) && $val['perm']!=='' && !getperms($val['perm']))
{
continue;
}
@ -1569,7 +1569,7 @@ class e_admin_dispatcher
if(empty($var)) return '';
$request = $this->getRequest();
if(!$selected) $selected = $request->getMode().'/'.$request->getAction();
$selected = vartrue($this->adminMenuAliases[$selected], $selected);

View File

@ -790,7 +790,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
$array_functions = array(
0 => array(e_ADMIN_ABS.'administrator.php', ADLAN_8, ADLAN_9, '3', 2, E_16_ADMIN, E_32_ADMIN),
1 => array(e_ADMIN_ABS.'updateadmin.php', ADLAN_10, ADLAN_11, '', 2, E_16_ADPASS, E_32_ADPASS),
1 => array(e_ADMIN_ABS.'updateadmin.php', ADLAN_10, ADLAN_11, false, 2, E_16_ADPASS, E_32_ADPASS),
2 => array(e_ADMIN_ABS.'banlist.php', ADLAN_34, ADLAN_35, '4', 2, E_16_BANLIST, E_32_BANLIST),
4 => array(e_ADMIN_ABS.'cache.php', ADLAN_74, ADLAN_75, 'C', 1, E_16_CACHE, E_32_CACHE),
5 => array(e_ADMIN_ABS.'cpage.php', ADLAN_42, ADLAN_43, '5|J', 3, E_16_CUST, E_32_CUST),