mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Page support for single page with anchor navigation.
This commit is contained in:
@@ -51,7 +51,7 @@ else
|
||||
$highlighted_text = highlight_string($code_text, TRUE);
|
||||
$highlighted_text = str_replace(array("<code>","</code>"),"",$highlighted_text);
|
||||
$divClass = ($parm) ? $parm : 'code_highlight';
|
||||
$ret = "<code class='".$tp -> toAttribute($divClass)." code-box {$class}' style='unicode-bidi: embed; direction: ltr'>{$highlighted_text}</code>";
|
||||
$ret = "<pre class='prettyprint linenums ".$tp -> toAttribute($divClass)." code-box {$class}' style='unicode-bidi: embed; direction: ltr'>{$highlighted_text}</pre>";
|
||||
}
|
||||
$ret = str_replace("[", "[", $ret);
|
||||
return $ret;
|
@@ -20,7 +20,7 @@ class cpage_shortcodes extends e_shortcode
|
||||
// var $var; // parsed DB values
|
||||
|
||||
function sc_cpagetitle($parm='')
|
||||
{
|
||||
{
|
||||
return e107::getParser()->toHTML($this->getParserVars()->title, true, 'TITLE');
|
||||
}
|
||||
|
||||
@@ -81,6 +81,12 @@ class cpage_shortcodes extends e_shortcode
|
||||
return $this->page['page_id'];
|
||||
}
|
||||
|
||||
function sc_cpageanchor()
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
return $frm->name2id($this->page['page_title']);
|
||||
}
|
||||
|
||||
// Not a shortcode really, as it shouldn't be cached at all :/
|
||||
function cpagecomments()
|
||||
{
|
||||
|
@@ -573,10 +573,17 @@ echo "</head>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
echo "<body".$body_onload.">\n";
|
||||
if(!deftrue('BODYTAG')) //TODO Discuss a better way?
|
||||
{
|
||||
echo "<body".$body_onload.">\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo BODYTAG."\n";
|
||||
}
|
||||
|
||||
// Bootstrap Modal Window - too important to template.
|
||||
/*
|
||||
echo '<div id="uiModal" style="display:none" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
@@ -590,7 +597,7 @@ echo '<div id="uiModal" style="display:none" class="modal hide fade" tabindex="-
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@@ -1732,6 +1732,7 @@ class e_form
|
||||
|
||||
function name2id($name)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
return rtrim(str_replace(array('[]', '[', ']', '_', '/', ' ','.'), array('-', '-', '', '-', '-', '-', '-'), $name), '-');
|
||||
}
|
||||
|
||||
|
@@ -1584,4 +1584,9 @@ class navigation_shortcodes extends e_shortcode
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_link_anchor($parm='')
|
||||
{
|
||||
return $this->var['link_name'] ? '#'.e107::getForm()->name2id($this->var['link_name']) : '';
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ class page_sitelink // include plugin-folder in the name.
|
||||
|
||||
function pageNav($parm='')
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
$options = array();
|
||||
if(vartrue($parm))
|
||||
{
|
||||
@@ -70,9 +71,10 @@ class page_sitelink // include plugin-folder in the name.
|
||||
|
||||
$query = "SELECT * FROM #page WHERE ";
|
||||
$q = array();
|
||||
|
||||
if(vartrue($options['chapter']))
|
||||
{
|
||||
$q[] = "page_chapter = ".intval($options['chapter']);
|
||||
$q[] = "page_title !='' AND page_chapter = ".intval($options['chapter']);
|
||||
}
|
||||
elseif(vartrue($options['book']))
|
||||
{
|
||||
@@ -100,7 +102,7 @@ class page_sitelink // include plugin-folder in the name.
|
||||
'link_parent' => $row['page_chapter'],
|
||||
'link_open' => '',
|
||||
'link_class' => intval($row['page_class']),
|
||||
'link_active' => ($options['cpage'] && $row['page_id'] == $options['cpage']),
|
||||
'link_active' => ($options['cpage'] && $row['page_id'] == $options['cpage'])
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -10,9 +10,12 @@
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$template = e107::getCoreTemplate('page','nav');
|
||||
|
||||
|
||||
$parm = eHelper::scParams($parm);
|
||||
|
||||
$template = e107::getCoreTemplate('page',vartrue($parm['template'],'nav'), true, true); // always merge
|
||||
|
||||
$request = e107::getRegistry('core/pages/request');
|
||||
if($request && is_array($request))
|
||||
{
|
||||
|
@@ -4,7 +4,8 @@ if ( ! defined('e107_INIT')) { exit(); }
|
||||
* This is a 100% Pure Bootstrap Theme for e107 v2
|
||||
*/
|
||||
|
||||
define("VIEWPORT","width=device-width, initial-scale=1.0");
|
||||
define("VIEWPORT", "width=device-width, initial-scale=1.0");
|
||||
define("BODYTAG", '<body data-spy="scroll" data-target=".bs-docs-sidebar" >');
|
||||
|
||||
e107::lan('theme');
|
||||
e107::js('core','bootstrap/js/bootstrap.min.js');
|
||||
@@ -12,6 +13,18 @@ e107::css('core','bootstrap/css/bootstrap.min.css');
|
||||
e107::css('core','bootstrap/css/bootstrap-responsive.min.css');
|
||||
e107::css('core','bootstrap/css/jquery-ui.custom.css');
|
||||
|
||||
e107::css('theme', 'js/google-code-prettify/prettify.css');
|
||||
e107::js('theme', "js/google-code-prettify/prettify.js");
|
||||
|
||||
if(THEME_LAYOUT == 'docs')
|
||||
{
|
||||
e107::css('inline','body { padding-top: 40px }');
|
||||
e107::css('theme','css/docs.css');
|
||||
e107::js('theme', "js/holder/holder.js");
|
||||
e107::js('theme', "js/application.js");
|
||||
}
|
||||
|
||||
|
||||
//$no_core_css = TRUE;
|
||||
|
||||
//define("STANDARDS_MODE",TRUE);
|
||||
@@ -48,6 +61,14 @@ function tablestyle($caption, $text, $mode='')
|
||||
$type = 'box';
|
||||
}
|
||||
|
||||
if($style == 'navdoc')
|
||||
{
|
||||
echo $text;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($mode == 'wm') // Welcome Message Style.
|
||||
{
|
||||
|
||||
@@ -370,11 +391,83 @@ $FOOTER['marketing-narrow'] = '
|
||||
|
||||
|
||||
|
||||
$HEADER['docs'] = <<<TMPL
|
||||
|
||||
<!-- Navbar
|
||||
================================================== -->
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="brand" href="./index.html">Bootstrap</a>
|
||||
<div class="nav-collapse collapse">
|
||||
{NAVIGATION=main}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Subhead
|
||||
================================================== -->
|
||||
<header class="jumbotron subhead" id="overview">
|
||||
<div class="container">
|
||||
<h1>Documentation</h1>
|
||||
<p class="lead">How to get started..</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<!-- Docs nav
|
||||
================================================== -->
|
||||
<div class="row">
|
||||
|
||||
<div class="span3 bs-docs-sidebar">
|
||||
{SETSTYLE=navdoc}
|
||||
{PLUGIN=page/page_navigation_menu|template=navdoc&auto=1}
|
||||
</div>
|
||||
{SETSTYLE=doc}
|
||||
|
||||
<div class="span9">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TMPL;
|
||||
|
||||
|
||||
$FOOTER['docs'] = <<<TMPL
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer
|
||||
================================================== -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p>{SITEDISCLAIMER}</p>
|
||||
<!--
|
||||
<ul class="footer-links">
|
||||
<li><a href="http://blog.getbootstrap.com">Blog</a></li>
|
||||
<li class="muted">·</li>
|
||||
<li><a href="https://github.com/twitter/bootstrap/issues?state=open">Issues</a></li>
|
||||
<li class="muted">·</li>
|
||||
<li><a href="https://github.com/twitter/bootstrap/blob/master/CHANGELOG.md">Changelog</a></li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
TMPL;
|
||||
|
||||
|
||||
|
||||
|
@@ -19,5 +19,6 @@
|
||||
</layout>
|
||||
<layout name='hero' title='Hero' />
|
||||
<layout name='marketing-narrow' title='Marketing Narrow' />
|
||||
<layout name='docs' title='Documentation' />
|
||||
</layouts>
|
||||
</e107Theme>
|
59
page.php
59
page.php
@@ -49,8 +49,31 @@ elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter
|
||||
$e107CorePage->setRequest('listPages');
|
||||
|
||||
require_once(HEADERF);
|
||||
|
||||
if($_GET['action']=='all') // See bootstrap 'docs' layout for an example.
|
||||
{
|
||||
$template = array();
|
||||
$template['start'] = '';
|
||||
$template['item'] = '
|
||||
<section id="{CPAGEANCHOR}">
|
||||
<div class="page-header">
|
||||
<h1>{CPAGETITLE}</h1>
|
||||
</div>
|
||||
{CPAGEBODY}
|
||||
</section>
|
||||
';
|
||||
$template['end'] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$template = array();
|
||||
$template['start'] = "<ul class='page-pages-list'>";
|
||||
$template['item'] = "<li><a href='{CPAGEURL}'>{CPAGETITLE}</a></li>";
|
||||
$template['end'] = "</ul>";
|
||||
}
|
||||
|
||||
|
||||
$text = $e107CorePage->listPages($_GET['ch']);
|
||||
$text = $e107CorePage->listPages($_GET['ch'],$template);
|
||||
$ns->tablerender('', $text, 'cpage'); // TODO FIXME Caption eg. "book title"
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
@@ -213,10 +236,13 @@ class pageClass
|
||||
|
||||
|
||||
// TODO template for page list
|
||||
function listPages($chapt=0)
|
||||
function listPages($chapt=0,$template='')
|
||||
{
|
||||
$sql = e107::getDb('pg');
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb('pg');
|
||||
$tp = e107::getParser();
|
||||
$this->batch = e107::getScBatch('page',null,'cpage');
|
||||
|
||||
|
||||
|
||||
if(!e107::getPref('listPages', false))
|
||||
{
|
||||
@@ -226,20 +252,37 @@ class pageClass
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$sql->db_Select("page", "*", "menu_name='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
|
||||
if(!$count = $sql->db_Select("page", "*", "page_title !='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
|
||||
{
|
||||
|
||||
$text = "<ul class='page-pages-list page-pages-none'><li>".LAN_PAGE_2."</li></ul>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<ul class='page-pages-list'>";
|
||||
|
||||
// $text .= "<ul class='page-pages-list'>";
|
||||
$text .= $template['start'];
|
||||
|
||||
$pageArray = $sql->db_getList();
|
||||
|
||||
foreach($pageArray as $page)
|
||||
{
|
||||
$data = array(
|
||||
'title' => $page['page_title'],
|
||||
'text' => $tp->toHtml($page['page_text'],true)
|
||||
);
|
||||
|
||||
$this->page = $page;
|
||||
$this->batch->setVars(new e_vars($data))->setScVar('page', $this->page);
|
||||
|
||||
$url = e107::getUrl()->create('page/view', $page, 'allow=page_id,page_sef');
|
||||
$text .= "<li><a href='".$url."'>".$tp->toHtml($page['page_title'])."</a></li>";
|
||||
// $text .= "<li><a href='".$url."'>".$tp->toHtml($page['page_title'])."</a></li>";
|
||||
$text .= e107::getParser()->parseTemplate($template['item'], true, $this->batch);
|
||||
}
|
||||
$text .= "</ul>";
|
||||
|
||||
$text .= $template['end'];
|
||||
|
||||
// $text .= "</ul>";
|
||||
// $caption = ($title !='')? $title: LAN_PAGE_11;
|
||||
// e107::getRender()->tablerender($caption, $text,"cpage_list");
|
||||
}
|
||||
|
Reference in New Issue
Block a user