exit(1);
}
-require_once INSTALLDIR.'/lib/form.php';
+require_once INSTALLDIR.'/lib/noticeform.php';
require_once INSTALLDIR.'/lib/htmloutputter.php';
/**
{
var $args;
- function Action()
+ /**
+ * Constructor
+ *
+ * Just wraps the HTMLOutputter constructor.
+ *
+ * @param string $output URI to output to, default = stdout
+ * @param boolean $indent Whether to indent output, default true
+ *
+ * @see XMLOutputter::__construct
+ * @see HTMLOutputter::__construct
+ */
+
+ function __construct($output='php://output', $indent=true)
{
+ parent::__construct($output, $indent);
}
// For initializing members of the class
function showHead()
{
// XXX: attributes (profile?)
- $this->startElement('head');
+ $this->elementStart('head');
$this->showTitle();
$this->showStylesheets();
$this->showScripts();
$this->showFeeds();
$this->showDescription();
$this->extraHead();
- $this->elementElement('head');
+ $this->elementEnd('head');
}
function showTitle()
{
$this->element('link', array('rel' => 'stylesheet',
'type' => 'text/css',
- 'href' => theme_path('display.css') . '?version=' . LACONICA_VERSION,
+ 'href' => theme_path('css/display.css', 'base') . '?version=' . LACONICA_VERSION,
+ 'media' => 'screen, projection, tv'));
+ $this->element('link', array('rel' => 'stylesheet',
+ 'type' => 'text/css',
+ 'href' => theme_path('css/thickbox.css', 'base') . '?version=' . LACONICA_VERSION,
+ 'media' => 'screen, projection, tv'));
+ $this->element('link', array('rel' => 'stylesheet',
+ 'type' => 'text/css',
+ 'href' => theme_path('css/display.css', null) . '?version=' . LACONICA_VERSION,
'media' => 'screen, projection, tv'));
foreach (array(6,7) as $ver) {
if (file_exists(theme_file('ie'.$ver.'.css'))) {
// Yes, IE people should be put in jail.
- $xw->writeComment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
- 'href="'.theme_path('ie'.$ver.'.css').'?version='.LACONICA_VERSION.'" /><![endif]');
+ $this->comment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
+ 'href="'.theme_path('ie'.$ver.'.css').'?version='.LACONICA_VERSION.'" /><![endif]');
}
}
}
function showBody()
{
$this->elementStart('body');
- $this->elementStart('wrap');
+ $this->elementStart('div', 'wrap');
$this->showHeader();
$this->showCore();
$this->showFooter();
- $this->elementEnd('wrap');
+ $this->elementEnd('div', 'wrap');
$this->elementEnd('body');
}
$this->showLogo();
$this->showPrimaryNav();
$this->showSiteNotice();
- $this->showNoticeForm();
+ if (common_logged_in()) {
+ $this->showNoticeForm();
+ } else {
+ $this->showAnonymousMessage();
+ }
$this->elementEnd('div');
}
{
$this->elementStart('dl', array('id' => 'site_nav_global_primary'));
$this->element('dt', null, _('Primary site navigation'));
+ $this->elementStart('dd');
$user = common_current_user();
- $this->elementStart('ul', array('id' => 'nav'));
+ $this->elementStart('ul', array('class' => 'nav'));
if ($user) {
- common_menu_item(common_local_url('all', array('nickname' => $user->nickname)),
+ $this->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
_('Home'));
}
- common_menu_item(common_local_url('peoplesearch'), _('Search'));
+ $this->menuItem(common_local_url('peoplesearch'), _('Search'));
if ($user) {
- common_menu_item(common_local_url('profilesettings'),
+ $this->menuItem(common_local_url('profilesettings'),
_('Settings'));
- common_menu_item(common_local_url('invite'),
+ $this->menuItem(common_local_url('invite'),
_('Invite'));
- common_menu_item(common_local_url('logout'),
+ $this->menuItem(common_local_url('logout'),
_('Logout'));
} else {
- common_menu_item(common_local_url('login'), _('Login'));
+ $this->menuItem(common_local_url('login'), _('Login'));
if (!common_config('site', 'closed')) {
- common_menu_item(common_local_url('register'), _('Register'));
+ $this->menuItem(common_local_url('register'), _('Register'));
}
- common_menu_item(common_local_url('openidlogin'), _('OpenID'));
+ $this->menuItem(common_local_url('openidlogin'), _('OpenID'));
}
- common_menu_item(common_local_url('doc', array('title' => 'help')),
+ $this->menuItem(common_local_url('doc', array('title' => 'help')),
_('Help'));
$this->elementEnd('ul');
+ $this->elementEnd('dd');
$this->elementEnd('dl');
}
// Revist. Should probably do an hAtom pattern here
function showSiteNotice()
{
- $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');
+ $text = common_config('site', 'notice');
+ if ($text) {
+ $this->elementStart('dl', array('id' => 'site_notice',
+ 'class' => 'system_notice'));
+ $this->element('dt', null, _('Site notice'));
+ $this->element('dd', null, $text);
+ $this->elementEnd('dl');
+ }
}
-
+
// MAY overload if no notice form needed... or direct message box????
function showNoticeForm()
{
- $notice_form = new NoticeForm();
+ $notice_form = new NoticeForm($this);
$notice_form->show();
}
+ function showAnonymousMessage()
+ {
+ // needs to be defined by the class
+ }
+
function showCore()
{
- $this->elementStart('div', array('class' => 'core'));
+ $this->elementStart('div', array('id' => 'core'));
$this->showLocalNav();
$this->showContentBlock();
$this->showAside();
$this->elementEnd('div');
}
- // SHOULD overload (perhaps this should be a MUST because sometimes it is not used)
+ // SHOULD overload
- function showLocalNav($menu)
+ function showLocalNav()
{
- $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');
+ // does nothing by default
}
function showContentBlock()
{
$this->elementStart('div', array('id' => 'content'));
$this->showPageTitle();
- $this->showPageNotice();
+ $this->showPageNoticeBlock();
+ $this->elementStart('div', array('id' => 'content_inner'));
+ // show the actual content (forms, lists, whatever)
$this->showContent();
$this->elementEnd('div');
+ $this->elementEnd('div');
}
function showPageTitle() {
$this->element('h1', NULL, $this->title());
}
+ function showPageNoticeBlock()
+ {
+ $this->elementStart('dl', array('id' => 'page_notice',
+ 'class' => 'system_notice'));
+ $this->element('dt', null, _('Page notice'));
+ $this->elementStart('dd', null);
+ $this->showPageNotice();
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
+ }
+
// SHOULD overload (unless there's not a notice)
function showPageNotice()
{
- $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
function showContent()
{
- // show the actual content (forms, lists, whatever)
- $this->elementStart('div', array('id' => 'content_inner'));
- $this->elementEnd('div');
}
function showAside()
{
+ $this->elementStart('div', array('id' => 'aside_primary',
+ 'class' => 'aside'));
$this->showExportData();
$this->showSections();
+ $this->elementEnd('div');
}
// MAY overload if there are feeds
function showSecondaryNav()
{
- $this->elementStart('ul', array('id' => 'nav_sub'));
- common_menu_item(common_local_url('doc', array('title' => 'help')),
+ $this->elementStart('dl', array('id' => 'site_nav_global_secondary'));
+ $this->element('dt', null, _('Secondary site navigation'));
+ $this->elementStart('dd', null);
+ $this->elementStart('ul', array('class' => 'nav'));
+ $this->menuItem(common_local_url('doc', array('title' => 'help')),
_('Help'));
- common_menu_item(common_local_url('doc', array('title' => 'about')),
+ $this->menuItem(common_local_url('doc', array('title' => 'about')),
_('About'));
- common_menu_item(common_local_url('doc', array('title' => 'faq')),
+ $this->menuItem(common_local_url('doc', array('title' => 'faq')),
_('FAQ'));
- common_menu_item(common_local_url('doc', array('title' => 'privacy')),
+ $this->menuItem(common_local_url('doc', array('title' => 'privacy')),
_('Privacy'));
- common_menu_item(common_local_url('doc', array('title' => 'source')),
+ $this->menuItem(common_local_url('doc', array('title' => 'source')),
_('Source'));
- common_menu_item(common_local_url('doc', array('title' => 'contact')),
+ $this->menuItem(common_local_url('doc', array('title' => 'contact')),
_('Contact'));
$this->elementEnd('ul');
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
}
function showLicenses()
}
$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);
- common_raw($output);
+ $this->raw($output);
$this->elementEnd('dd');
// do it
}
$this->element('dt', array('id' => 'site_content_license'), _('Laconica software license'));
$this->elementStart('dd', array('id' => 'site_content_license_cc'));
$this->elementStart('p');
- common_text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
+ $this->text(_('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
$this->element('a', array('class' => 'license',
'rel' => 'external license',
- 'href' => $config['license']['url']),
- $config['license']['title']);
- common_text(_('. Contributors should be attributed by full name or nickname.'));
+ 'href' => common_config('license', 'url')),
+ common_config('license', 'title'));
+ $this->text(_('. Contributors should be attributed by full name or nickname.'));
$this->elementEnd('p');
$this->element('img', array('id' => 'license_cc',
- 'src' => $config['license']['image'],
- 'alt' => $config['license']['title']));
+ 'src' => common_config('license', 'image'),
+ 'alt' => common_config('license', 'title')));
$this->elementEnd('dd');
}
}
}
- function server_error($msg, $code=500)
+ function serverError($msg, $code=500)
{
$action = $this->trimmed('action');
common_debug("Server error '$code' on '$action': $msg", __FILE__);
common_server_error($msg, $code);
}
- function client_error($msg, $code=400)
+ function clientError($msg, $code=400)
{
$action = $this->trimmed('action');
common_debug("User error '$code' on '$action': $msg", __FILE__);
$action = $this->trimmed('action');
$this->elementStart('ul', array('id' => 'nav_views'));
foreach ($menu as $menuaction => $menudesc) {
- common_menu_item(common_local_url($menuaction,
+ $this->menuItem(common_local_url($menuaction,
isset($menudesc[2]) ? $menudesc[2] : null),
$menudesc[0],
$menudesc[1],
$this->elementStart('div', array('id' => 'content'));
}
+ // Added @id to li for some control.
+ // XXX: We might want to move this to htmloutputter.php
- // 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)
+ function menuItem($url, $text, $title=null, $is_selected=false, $id=null)
{
$lattrs = array();
if ($is_selected) {