showHeader() -- incomplete
showPrimaryNav() -- should be updated when common_menu_item() is
redone/fixed
showSiteNotice()
showLocalNav() -- needs a revisit for common_menu_item()
showContentBlock -- needs a revisit for basic pages
showPageNotice()
showContent() -- inner should be opened for content
showFooter()
showLicenses()
showLaconicaLicense()
showContentLicense()
common_menu_item() -- Added @id for list-items. Revisit.
pagination()

Needs attention for common_menu_item() and then they can be removed:
nav_menu
common_show_header()
This commit is contained in:
sarven 2009-01-14 08:44:23 +00:00
parent 3b19d00ae9
commit 24d8814bc5

View File

@ -178,12 +178,23 @@ class Action extends HTMLOutputter // lawsuit
function showHeader() function showHeader()
{ {
// start header div stuff $this->elementStart('div', array('id' => 'header'));
$this->showLogo(); $this->showLogo();
// common_element('h1', 'pagetitle', $pagetitle);
if ($headercall) {
if ($data) {
call_user_func($headercall, $data);
} else {
call_user_func($headercall);
}
}
//common_nav_menu();
$this->showPrimaryNav(); $this->showPrimaryNav();
$this->showSiteNotice(); $this->showSiteNotice();
$this->showNoticeForm(); $this->showNoticeForm();
// end header div stuff $this->elementEnd('div');
} }
function showLogo() function showLogo()
@ -198,15 +209,17 @@ class Action extends HTMLOutputter // lawsuit
$this->element('img', array('class' => 'logo photo', $this->element('img', array('class' => 'logo photo',
'src' => isset($config['site']['logo']) ? 'src' => isset($config['site']['logo']) ?
($config['site']['logo']) : theme_path('logo.png'), ($config['site']['logo']) : theme_path('logo.png'),
'alt' => $config['site']['name']); 'alt' => $config['site']['name']));
} }
$this->element('span', array('class' => 'fn org'), $config['site']['name'])); $this->element('span', array('class' => 'fn org'), $config['site']['name']);
$this->elementEnd('a'); $this->elementEnd('a');
$this->elementEnd('address'); $this->elementEnd('address');
} }
function showPrimaryNav() function showPrimaryNav()
{ {
$this->elementStart('dl', array('id' => 'site_nav_global_primary'));
$this->element('dt', null, _('Primary site navigation'));
$user = common_current_user(); $user = common_current_user();
$this->elementStart('ul', array('id' => 'nav')); $this->elementStart('ul', array('id' => 'nav'));
if ($user) { if ($user) {
@ -231,11 +244,19 @@ class Action extends HTMLOutputter // lawsuit
common_menu_item(common_local_url('doc', array('title' => 'help')), common_menu_item(common_local_url('doc', array('title' => 'help')),
_('Help')); _('Help'));
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->elementEnd('dl');
} }
// Revist. Should probably do an hAtom pattern here
function showSiteNotice() function showSiteNotice()
{ {
// show the site notice here $this->elementStart('dl', array('id' => 'site_notice',
'class' => 'system_notice'));
$this->element('dt', null, _('Site notice'));
$this->elementStart('dd', null);
// Output a bunch of paragraphs here
$this->elementEnd('dd');
} }
// MAY overload if no notice form needed... or direct message box???? // MAY overload if no notice form needed... or direct message box????
@ -254,17 +275,35 @@ class Action extends HTMLOutputter // lawsuit
// end core div // end core div
} }
// SHOULD overload // SHOULD overload (perhaps this should be a MUST because sometimes it is not used)
function showLocalNav() function showLocalNav($menu)
{ {
$action = $this->trimmed('action');
$this->elementStart('dl', array('id' => 'site_nav_local_views'));
$this->element('dt', null, _('Local views'));
$this->elementStart('ul', array('id' => 'nav'));
foreach ($menu as $menuaction => $menudesc) {
common_menu_item(common_local_url($menuaction,
isset($menudesc[2]) ? $menudesc[2] : null),
$menudesc[0],
$menudesc[1],
$action == $menuaction);
}
$this->elementEnd('ul');
$this->elementEnd('dd');
$this->elementEnd('dl');
} }
function showContentBlock() function showContentBlock()
{ {
$this->elementStart('div', array('id' => 'content',
(is_null("basic single content page e.g., about")) ? null : 'class' => 'hentry'));
$this->showPageTitle(); $this->showPageTitle();
$this->showPageNotice(); $this->showPageNotice();
$this->showContent(); $this->showContent();
$this->elementEnd('div');
} }
function showPageTitle() { function showPageTitle() {
@ -275,7 +314,12 @@ class Action extends HTMLOutputter // lawsuit
function showPageNotice() function showPageNotice()
{ {
// output page notice div $this->elementStart('dl', array('id' => 'page_notice',
'class' => 'system_notice'));
$this->element('dt', null, _('Page notice'));
$this->elementStart('dd', null);
// Output a bunch of paragraphs here
$this->elementEnd('dd');
} }
// MUST overload // MUST overload
@ -283,6 +327,9 @@ class Action extends HTMLOutputter // lawsuit
function showContent() function showContent()
{ {
// show the actual content (forms, lists, whatever) // show the actual content (forms, lists, whatever)
$this->elementStart('div', array('id' => 'content_inner',
(is_null("basic single content page e.g., about")) ? null : 'class' => 'entry-content'));
$this->elementEnd('div');
} }
function showAside() function showAside()
@ -308,9 +355,10 @@ class Action extends HTMLOutputter // lawsuit
function showFooter() function showFooter()
{ {
// start footer div $this->elementStart('div', array('id' => 'footer'));
$this->showSecondaryNav(); $this->showSecondaryNav();
$this->showLicenses(); $this->showLicenses();
$this->elementEnd('div');
} }
function showSecondaryNav() function showSecondaryNav()
@ -333,15 +381,16 @@ class Action extends HTMLOutputter // lawsuit
function showLicenses() function showLicenses()
{ {
// start license dl $this->elementStart('dl', array('id' => 'licenses'));
$this->showLaconicaLicense(); $this->showLaconicaLicense();
$this->showContentLicense(); $this->showContentLicense();
// end license dl $this->elementEnd('dl');
} }
function showLaconicaLicense() function showLaconicaLicense()
{ {
$this->elementStart('div', 'laconica'); $this->element('dt', array('id' => 'site_laconica_license'), _('Laconica software license'));
$this->elementStart('dd', null);
if (common_config('site', 'broughtby')) { if (common_config('site', 'broughtby')) {
$instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). '); $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
} else { } else {
@ -350,25 +399,26 @@ class Action extends HTMLOutputter // lawsuit
$instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION); $instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION);
$output = common_markup_to_html($instr); $output = common_markup_to_html($instr);
common_raw($output); common_raw($output);
$this->elementEnd('div'); $this->elementEnd('dd');
// do it // do it
} }
function showContentLicense() function showContentLicense()
{ {
$this->elementStart('div', array('id' => 'footer')); $this->element('dt', array('id' => 'site_content_license'), _('Laconica software license'));
$this->element('img', array('id' => 'cc', $this->elementStart('dd', array('id' => 'site_content_license_cc'));
'src' => $config['license']['image'],
'alt' => $config['license']['title']));
$this->elementStart('p'); $this->elementStart('p');
common_text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the ')); common_text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
$this->element('a', array('class' => 'license', $this->element('a', array('class' => 'license',
'rel' => 'license', 'rel' => 'external license',
'href' => $config['license']['url']), 'href' => $config['license']['url']),
$config['license']['title']); $config['license']['title']);
common_text(_('. Contributors should be attributed by full name or nickname.')); common_text(_('. Contributors should be attributed by full name or nickname.'));
$this->elementEnd('p'); $this->elementEnd('p');
$this->elementEnd('div'); $this->element('img', array('id' => 'license_cc',
'src' => $config['license']['image'],
'alt' => $config['license']['title']));
$this->elementEnd('dd');
} }
// For comparison with If-Last-Modified // For comparison with If-Last-Modified
@ -511,19 +561,6 @@ class Action extends HTMLOutputter // lawsuit
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body', $action); $this->elementStart('body', $action);
$this->elementStart('div', array('id' => 'wrap')); $this->elementStart('div', array('id' => 'wrap'));
$this->elementStart('div', array('id' => 'header'));
common_nav_menu();
$this->element('h1', 'pagetitle', $pagetitle);
if ($headercall) {
if ($data) {
call_user_func($headercall, $data);
} else {
call_user_func($headercall);
}
}
$this->elementEnd('div');
$this->elementStart('div', array('id' => 'content')); $this->elementStart('div', array('id' => 'content'));
} }
@ -538,13 +575,16 @@ class Action extends HTMLOutputter // lawsuit
common_end_xml(); common_end_xml();
} }
function common_menu_item($url, $text, $title=null, $is_selected=false)
// Added @id to li for some control. We might want to move this to htmloutputter.php
function common_menu_item($id=null, $url, $text, $title=null, $is_selected=false)
{ {
$lattrs = array(); $lattrs = array();
if ($is_selected) { if ($is_selected) {
$lattrs['class'] = 'current'; $lattrs['class'] = 'current';
} }
$this->elementStart('li', $lattrs);
$this->elementStart('li', (is_null($id)) ? null : array('id' => $id), $lattrs);
$attrs['href'] = $url; $attrs['href'] = $url;
if ($title) { if ($title) {
$attrs['title'] = $title; $attrs['title'] = $title;
@ -558,31 +598,36 @@ class Action extends HTMLOutputter // lawsuit
function pagination($have_before, $have_after, $page, $action, $args=null) function pagination($have_before, $have_after, $page, $action, $args=null)
{ {
if ($have_before || $have_after) { if ($have_before || $have_after) {
$this->elementStart('div', array('id' => 'pagination')); $this->elementStart('div', array('class' => 'pagination'));
$this->elementStart('ul', array('id' => 'nav_pagination')); $this->elementStart('dl', null);
$this->element('dt', null, _('Pagination'));
$this->elementStart('dd', null);
$this->elementStart('ul', array('class' => 'nav'));
} }
if ($have_before) { if ($have_before) {
$pargs = array('page' => $page-1); $pargs = array('page' => $page-1);
$newargs = ($args) ? array_merge($args,$pargs) : $pargs; $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
$this->elementStart('li', 'before'); $this->elementStart('li', array('class' => 'nav_prev'));
$this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'prev'), $this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'prev'),
_('« After')); _('After'));
$this->elementEnd('li'); $this->elementEnd('li');
} }
if ($have_after) { if ($have_after) {
$pargs = array('page' => $page+1); $pargs = array('page' => $page+1);
$newargs = ($args) ? array_merge($args,$pargs) : $pargs; $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
$this->elementStart('li', 'after'); $this->elementStart('li', array('class' => 'nav_next'));
$this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'next'), $this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'next'),
_('Before »')); _('Before'));
$this->elementEnd('li'); $this->elementEnd('li');
} }
if ($have_before || $have_after) { if ($have_before || $have_after) {
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->elementEnd('dd');
$this->elementEnd('dl');
$this->elementEnd('div'); $this->elementEnd('div');
} }
} }