push notice form and sub-menu into header div

darcs-hash:20080611183634-84dde-97119e7ef1abb01f6ce8723955dc5d6e06e644a8.gz
This commit is contained in:
Evan Prodromou 2008-06-11 14:36:34 -04:00
parent f4ed605998
commit d0f8fd20fb
6 changed files with 38 additions and 17 deletions

View File

@ -45,15 +45,8 @@ class AllAction extends StreamAction {
# Looks like we're good; show the header # Looks like we're good; show the header
common_show_header($profile->nickname . _t(" and friends"), common_show_header($profile->nickname . _t(" and friends"),
array($this, 'show_header'), $user); array($this, 'show_header'), $user,
array($this, 'show_top'));
$cur = common_current_user();
if ($cur && $cur->id == $profile->id) {
common_notice_form();
}
$this->views_menu();
$this->show_notices($profile); $this->show_notices($profile);
@ -68,6 +61,16 @@ class AllAction extends StreamAction {
'title' => _t('Feed for friends of ') . $user->nickname)); 'title' => _t('Feed for friends of ') . $user->nickname));
} }
function show_top($user) {
$cur = common_current_user();
if ($cur && $cur->id == $user->id) {
common_notice_form();
}
$this->views_menu();
}
function show_notices($profile) { function show_notices($profile) {
$notice = DB_DataObject::factory('notice'); $notice = DB_DataObject::factory('notice');

View File

@ -24,8 +24,7 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
class AvatarAction extends SettingsAction { class AvatarAction extends SettingsAction {
function show_form($msg=NULL, $success=false) { function show_form($msg=NULL, $success=false) {
common_show_header(_t('Avatar')); common_show_header(_t('Avatar'), NULL, NULL, array($this, 'settings_menu'));
$this->settings_menu();
if ($msg) { if ($msg) {
$this->message($msg, $success); $this->message($msg, $success);
} else { } else {

View File

@ -24,8 +24,7 @@ require_once(INSTALLDIR.'/lib/settingsaction.php');
class PasswordAction extends SettingsAction { class PasswordAction extends SettingsAction {
function show_form($msg=NULL, $success=false) { function show_form($msg=NULL, $success=false) {
common_show_header(_t('Change password')); common_show_header(_t('Change password'), NULL, NULL, array($this, 'settings_menu'));
$this->settings_menu();
if ($msg) { if ($msg) {
$this->message($msg, $success); $this->message($msg, $success);
} else { } else {

View File

@ -26,8 +26,8 @@ class ProfilesettingsAction extends SettingsAction {
function show_form($msg=NULL, $success=false) { function show_form($msg=NULL, $success=false) {
$user = common_current_user(); $user = common_current_user();
$profile = $user->getProfile(); $profile = $user->getProfile();
common_show_header(_t('Profile settings')); common_show_header(_t('Profile settings'), NULL, NULL, array($this, 'settings_menu'));
$this->settings_menu();
if ($msg) { if ($msg) {
$this->message($msg, $success); $this->message($msg, $success);
} else { } else {

View File

@ -52,7 +52,9 @@ class ShowstreamAction extends StreamAction {
header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' => header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
$user->nickname))); $user->nickname)));
common_show_header($profile->nickname, array($this, 'show_header'), $user); common_show_header($profile->nickname,
array($this, 'show_header'), $user,
array($this, 'show_top'));
$cur = common_current_user(); $cur = common_current_user();
@ -69,6 +71,17 @@ class ShowstreamAction extends StreamAction {
common_show_footer(); common_show_footer();
} }
function show_top($user) {
$cur = common_current_user();
if ($cur && $cur->id == $user->id) {
common_notice_form();
}
$this->views_menu();
}
function show_header($user) { function show_header($user) {
common_element('link', array('rel' => 'alternate', common_element('link', array('rel' => 'alternate',
'href' => common_local_url('userrss', array('nickname' => 'href' => common_local_url('userrss', array('nickname' =>

View File

@ -123,7 +123,7 @@ function common_end_xml() {
$xw->flush(); $xw->flush();
} }
function common_show_header($pagetitle, $callable=NULL, $data=NULL, $notice=NULL) { function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) {
global $config, $xw; global $config, $xw;
header('Content-Type: application/xhtml+xml'); header('Content-Type: application/xhtml+xml');
@ -170,6 +170,13 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $notice=NULL
'alt' => $config['site']['name'], 'alt' => $config['site']['name'],
'id' => 'logo')); 'id' => 'logo'));
common_element_end('a'); common_element_end('a');
if ($headercall) {
if ($data) {
call_user_func($headercall, $data);
} else {
call_user_func($headercall);
}
}
common_element_end('div'); common_element_end('div');
common_element_start('div', array('id' => 'content')); common_element_start('div', array('id' => 'content'));
} }