diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-06-11 14:36:34 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-06-11 14:36:34 -0400 |
commit | d0f8fd20fb9e50aad9568a458934b52a9439228c (patch) | |
tree | ad95b104b0e8dfb64b7b91dfef28f7fac8d04afb | |
parent | f4ed6059980afdaede47e33307c6432e83aea484 (diff) |
push notice form and sub-menu into header div
darcs-hash:20080611183634-84dde-97119e7ef1abb01f6ce8723955dc5d6e06e644a8.gz
-rw-r--r-- | actions/all.php | 21 | ||||
-rw-r--r-- | actions/avatar.php | 3 | ||||
-rw-r--r-- | actions/password.php | 3 | ||||
-rw-r--r-- | actions/profilesettings.php | 4 | ||||
-rw-r--r-- | actions/showstream.php | 15 | ||||
-rw-r--r-- | lib/util.php | 9 |
6 files changed, 38 insertions, 17 deletions
diff --git a/actions/all.php b/actions/all.php index 06d88477d..44e3fd239 100644 --- a/actions/all.php +++ b/actions/all.php @@ -45,15 +45,8 @@ class AllAction extends StreamAction { # Looks like we're good; show the header common_show_header($profile->nickname . _t(" and friends"), - array($this, 'show_header'), $user); - - $cur = common_current_user(); - - if ($cur && $cur->id == $profile->id) { - common_notice_form(); - } - - $this->views_menu(); + array($this, 'show_header'), $user, + array($this, 'show_top')); $this->show_notices($profile); @@ -68,6 +61,16 @@ class AllAction extends StreamAction { '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) { $notice = DB_DataObject::factory('notice'); diff --git a/actions/avatar.php b/actions/avatar.php index 2d8a9f81d..b91dd794c 100644 --- a/actions/avatar.php +++ b/actions/avatar.php @@ -24,8 +24,7 @@ require_once(INSTALLDIR.'/lib/settingsaction.php'); class AvatarAction extends SettingsAction { function show_form($msg=NULL, $success=false) { - common_show_header(_t('Avatar')); - $this->settings_menu(); + common_show_header(_t('Avatar'), NULL, NULL, array($this, 'settings_menu')); if ($msg) { $this->message($msg, $success); } else { diff --git a/actions/password.php b/actions/password.php index fe19f5f71..ee61c3e97 100644 --- a/actions/password.php +++ b/actions/password.php @@ -24,8 +24,7 @@ require_once(INSTALLDIR.'/lib/settingsaction.php'); class PasswordAction extends SettingsAction { function show_form($msg=NULL, $success=false) { - common_show_header(_t('Change password')); - $this->settings_menu(); + common_show_header(_t('Change password'), NULL, NULL, array($this, 'settings_menu')); if ($msg) { $this->message($msg, $success); } else { diff --git a/actions/profilesettings.php b/actions/profilesettings.php index e94d846bd..755c293c7 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -26,8 +26,8 @@ class ProfilesettingsAction extends SettingsAction { function show_form($msg=NULL, $success=false) { $user = common_current_user(); $profile = $user->getProfile(); - common_show_header(_t('Profile settings')); - $this->settings_menu(); + common_show_header(_t('Profile settings'), NULL, NULL, array($this, 'settings_menu')); + if ($msg) { $this->message($msg, $success); } else { diff --git a/actions/showstream.php b/actions/showstream.php index 6fed6df12..52dbcd0ff 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -52,7 +52,9 @@ class ShowstreamAction extends StreamAction { header('X-XRDS-Location: '. common_local_url('xrds', array('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(); @@ -69,6 +71,17 @@ class ShowstreamAction extends StreamAction { 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) { common_element('link', array('rel' => 'alternate', 'href' => common_local_url('userrss', array('nickname' => diff --git a/lib/util.php b/lib/util.php index aa0b8f02c..bbc411d81 100644 --- a/lib/util.php +++ b/lib/util.php @@ -123,7 +123,7 @@ function common_end_xml() { $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; 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'], 'id' => 'logo')); common_element_end('a'); + if ($headercall) { + if ($data) { + call_user_func($headercall, $data); + } else { + call_user_func($headercall); + } + } common_element_end('div'); common_element_start('div', array('id' => 'content')); } |