diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 01:19:38 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 01:19:38 +0000 |
commit | d7adaddab7189bc493d22d96fec424aedca09b11 (patch) | |
tree | ebfd5c994083bed934bbd23fa403cadf778849fa /views/default/page/elements | |
parent | e8380d051e50abec45b8ad3ed84ae57644b017d5 (diff) | |
download | elgg-d7adaddab7189bc493d22d96fec424aedca09b11.tar.gz elgg-d7adaddab7189bc493d22d96fec424aedca09b11.tar.bz2 |
reorganized the page views as discussed
git-svn-id: http://code.elgg.org/elgg/trunk@7559 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/page/elements')
-rw-r--r-- | views/default/page/elements/body.php | 14 | ||||
-rw-r--r-- | views/default/page/elements/content.php | 14 | ||||
-rw-r--r-- | views/default/page/elements/content_header.php | 94 | ||||
-rw-r--r-- | views/default/page/elements/content_header_member.php | 24 | ||||
-rw-r--r-- | views/default/page/elements/footer.php | 21 | ||||
-rw-r--r-- | views/default/page/elements/header.php | 24 | ||||
-rw-r--r-- | views/default/page/elements/header_logo.php | 12 | ||||
-rw-r--r-- | views/default/page/elements/html_begin.php | 93 | ||||
-rw-r--r-- | views/default/page/elements/html_end.php | 11 | ||||
-rw-r--r-- | views/default/page/elements/messages.php | 28 | ||||
-rw-r--r-- | views/default/page/elements/topbar.php | 44 | ||||
-rw-r--r-- | views/default/page/elements/topbar_logout.php | 14 |
12 files changed, 393 insertions, 0 deletions
diff --git a/views/default/page/elements/body.php b/views/default/page/elements/body.php new file mode 100644 index 000000000..6f7691693 --- /dev/null +++ b/views/default/page/elements/body.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg page body wrapper + * + * @uses $vars['body'] The HTML of the page body + */ + +$body = elgg_get_array_value('body', $vars, ''); + +echo <<<HTML +<div class="elgg-page-body"> + $body +</div> +HTML; diff --git a/views/default/page/elements/content.php b/views/default/page/elements/content.php new file mode 100644 index 000000000..f82720c2f --- /dev/null +++ b/views/default/page/elements/content.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg content wrapper + * + * @uses $vars['body'] The main content HTML + */ + +$body = elgg_get_array_value('body', $vars, ''); + +echo <<<HTML +<div class="elgg-page-body"> + $body +</div> +HTML; diff --git a/views/default/page/elements/content_header.php b/views/default/page/elements/content_header.php new file mode 100644 index 000000000..8809ad8b7 --- /dev/null +++ b/views/default/page/elements/content_header.php @@ -0,0 +1,94 @@ +<?php +/** + * Displays the Add New button, and the All, Mine, My Friends tabs for plugins + * If a user is not logged in, this only displays the All tab. + * If this is in a group context, it doesn't display any tabs + * + * @uses string $vars['type'] The section type. Should be the same as the page handler. Used for generating URLs. + * @uses string $vars['context'] Which filter we're looking at: all, mine, friends, or action. Nothing to do with get_context(). + * + * @uses string $vars['all_link'] Optional. The URL to use for the "All" tab link. Defaults to mod/$type/all.php + * @uses string $vars['mine_link'] Optional. The URL to use for the "Mine" tab link. Defaults to pg/$type/$username + * @uses string $vars['friends_link'] Optional. The URL to use for the "Friends" tab link. Defaults to pg/$type/$username/friends + * @uses string $vars['new_link'] Optional. The URL to use for the "New" button. Defaults to pg/$type/$username/new + * @uses array $vars['tabs'] Optional. Override all tab generation. See view:navgiation/tabs for formatting + * + * @package Elgg + * @subpackage Core + */ + +$page_owner = elgg_get_page_owner(); +$logged_in_user = get_loggedin_user(); +$username = $logged_in_user->username; + +if (!$page_owner) { + $page_owner = $logged_in_user; +} + +// so we know if the user is looking at their own, everyone's or all friends +$filter_context = $vars['context']; + +// get the object type +$type = $vars['type']; + +// create an empty string to start with +$new_button = ''; + +// generate a list of default tabs +$default_tabs = array( + 'all' => array( + 'title' => elgg_echo('all'), + 'url' => (isset($vars['all_link'])) ? $vars['all_link'] : "mod/$type/all.php", + 'selected' => ($filter_context == 'everyone'), + ), + 'mine' => array( + 'title' => elgg_echo('mine'), + 'url' => (isset($vars['mine_link'])) ? $vars['mine_link'] : "pg/$type/$username", + 'selected' => ($filter_context == 'mine'), + ), + 'friend' => array( + 'title' => elgg_echo('friends'), + 'url' => (isset($vars['friend_link'])) ? $vars['friend_link'] : "pg/$type/$username/friends", + 'selected' => ($filter_context == 'friends'), + ), +); + +// determine if using default or overwritten tabs +$tabs = (isset($vars['tabs'])) ? $vars['tabs'] : $default_tabs; +$tab_list = elgg_view('navigation/tabs', array('tabs' => $tabs)); + +$title = elgg_echo($type); +$title = '<div class="content-header-title">' . elgg_view_title($title) . '</div>'; + +// must be logged in to see any action buttons +if (isloggedin()) { + // only show the new button when not on the add form. + // hide the tabs when on the add form. + if ($filter_context == 'action') { + $tab_list = ''; + } else { + // @todo remove the hard coded reference to the videolist plugin + if (elgg_get_context() == "videolist"){ + $video_link = elgg_get_site_url() . "pg/videolist/browse/$username/"; + $new_button = "<a href=\"{$video_link}\" class='action-button'>" . elgg_echo('videolist:browsemenu') . '</a>'; + } else { + $new_link = elgg_normalize_url((isset($vars['new_link'])) ? $vars['new_link'] : "pg/$type/$username/new"); + $new_button = "<a href=\"{$new_link}\" class='action-button'>" . elgg_echo($type . ':new') . '</a>'; + } + $new_button = "<div class='content-header-options'>$new_button</div>"; + } + + // also hide the tabs if in a group context (ie, listing groups) or + // when viewing tools belonging to a group + if (elgg_get_context() == 'groups' || $page_owner instanceof ElggGroup) { + $tab_list = ''; + } +} + +echo <<<HTML +<div id="content-header" class="clearfix"> + $title $new_button +</div> +HTML; + +echo $tab_list; diff --git a/views/default/page/elements/content_header_member.php b/views/default/page/elements/content_header_member.php new file mode 100644 index 000000000..4cfee9258 --- /dev/null +++ b/views/default/page/elements/content_header_member.php @@ -0,0 +1,24 @@ +<?php
+/**
+ * When looking at a users blog, bookmarks, video etc only show
+ * the users name and the tool you are viewing
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ */
+
+$page_owner = elgg_get_page_owner();
+$name = elgg_get_page_owner()->name;
+
+// get the object type
+$type = $vars['type'];
+
+$title = elgg_echo($type);
+$title = $name . "'s " . $type;
+?>
+
+<div id="content-header" class="clearfix">
+ <?php echo '<div class="content-header-title">' . elgg_view_title($title) . '</div>'; ?>
+</div>
+
diff --git a/views/default/page/elements/footer.php b/views/default/page/elements/footer.php new file mode 100644 index 000000000..6c9cdc55e --- /dev/null +++ b/views/default/page/elements/footer.php @@ -0,0 +1,21 @@ +<?php +/** + * Elgg footer + * The standard HTML footer that displays across the site + * + * @package Elgg + * @subpackage Core + * + */ + +?> +<div class="elgg-page-footer"> + <div class="elgg-page-footer-inner elgg-center elgg-width-classic clearfix"> + <?php echo elgg_view('footer/links'); ?> + <a href="http://www.elgg.org" class="right"> + <img src="<?php echo elgg_get_site_url(); ?>_graphics/powered_by_elgg_badge_drk_bckgnd.gif" alt="Powered by Elgg" /> + </a> + </div> +</div> + +<?php echo elgg_view('footer/analytics'); ?> diff --git a/views/default/page/elements/header.php b/views/default/page/elements/header.php new file mode 100644 index 000000000..148279b2e --- /dev/null +++ b/views/default/page/elements/header.php @@ -0,0 +1,24 @@ +<?php +/** + * Elgg header contents + * This file holds the header output that a user will see + **/ + +?> +<div class="elgg-page-header"> + <div class="elgg-page-header-inner elgg-center elgg-width-classic"> + <?php + // link back to main site. + echo elgg_view('page/elements/header_logo', $vars); + + // drop-down login + echo elgg_view('account/login-dropdown'); + + // insert site-wide navigation + echo elgg_view('navigation/site_nav'); + + // insert a view which can be extended + echo elgg_view('header/extend'); + ?> + </div> +</div> diff --git a/views/default/page/elements/header_logo.php b/views/default/page/elements/header_logo.php new file mode 100644 index 000000000..6ae6a0fab --- /dev/null +++ b/views/default/page/elements/header_logo.php @@ -0,0 +1,12 @@ +<?php +/** + * Elgg header logo + * The logo to display in elgg-header. + */ +?> + +<h1> + <a href="<?php echo elgg_get_site_url(); ?>"> + <span class='network-title'><?php echo $vars['config']->sitename; ?></span> + </a> +</h1> diff --git a/views/default/page/elements/html_begin.php b/views/default/page/elements/html_begin.php new file mode 100644 index 000000000..23879dde8 --- /dev/null +++ b/views/default/page/elements/html_begin.php @@ -0,0 +1,93 @@ +<?php +/** + * Start html output. + * The standard HTML header that displays across the site + * + * @uses $vars['config'] The site configuration settings, imported + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + */ + +// Set title +if (empty($vars['title'])) { + $title = $vars['config']->sitename; +} else if (empty($vars['config']->sitename)) { + $title = $vars['title']; +} else { + $title = $vars['config']->sitename . ": " . $vars['title']; +} + +global $autofeed; +if (isset($autofeed) && $autofeed == true) { + $url = full_url(); + if (substr_count($url,'?')) { + $url .= "&view=rss"; + } else { + $url .= "?view=rss"; + } + $url = elgg_format_url($url); + $feedref = <<<END + + <link rel="alternate" type="application/rss+xml" title="RSS" href="{$url}" /> + +END; +} else { + $feedref = ""; +} + +$js = elgg_get_js('head'); +$css = elgg_get_css(); + +// we won't trust server configuration but specify utf-8 +header('Content-type: text/html; charset=utf-8'); + +$version = get_version(); +$release = get_version(true); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="ElggRelease" content="<?php echo $release; ?>" /> + <meta name="ElggVersion" content="<?php echo $version; ?>" /> + <title><?php echo $title; ?></title> + <link rel="SHORTCUT ICON" href="<?php echo elgg_get_site_url(); ?>_graphics/favicon.ico" /> + +<?php +foreach ($js as $script) { +?> + <script type="text/javascript" src="<?php echo $script; ?>"></script> +<?php +} + +foreach ($css as $link) { +?> + <link rel="stylesheet" href="<?php echo $link; ?>" type="text/css" /> +<?php +} + +$ie_url = elgg_view_get_simplecache_url('css', 'ie'); +$ie6_url = elgg_view_get_simplecache_url('css', 'ie6'); +?> + <!--[if IE 6]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie_url; ?>" /> + <![endif]--> + + <!--[if gt IE 6]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie6_url; ?>" /> + <![endif]--> +<?php + +echo elgg_view('scripts/initialize_elgg'); +echo $feedref; + +$metatags = elgg_view('metatags', $vars); +if ($metatags) { + elgg_deprecated_notice("The metatags view has been deprecated for html_head/extend", 1.8); + echo $metatags; +} +echo elgg_view('html_head/extend', $vars); +?> +</head> + +<body> diff --git a/views/default/page/elements/html_end.php b/views/default/page/elements/html_end.php new file mode 100644 index 000000000..0862934cf --- /dev/null +++ b/views/default/page/elements/html_end.php @@ -0,0 +1,11 @@ +<?php +/** + * Start html output. + * The standard HTML header that displays across the site + * @uses $vars['config'] The site configuration settings, imported + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + */ +?> +</body> +</html> diff --git a/views/default/page/elements/messages.php b/views/default/page/elements/messages.php new file mode 100644 index 000000000..f44d1204b --- /dev/null +++ b/views/default/page/elements/messages.php @@ -0,0 +1,28 @@ +<?php +/** + * Elgg global system message list + * Lists all system messages + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['object'] The array of message registers + */ + +if (isset($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) { + + echo '<ul class="elgg-system-messages">'; + + foreach ($vars['object'] as $type => $list ) { + foreach ($list as $message) { + echo "<li class=\"elgg-state-$type radius8\">"; + echo elgg_view('output/longtext', array( + 'value' => $message, + 'parse_urls' => false + )); + echo '</li>'; + } + } + + echo '</ul>'; +} diff --git a/views/default/page/elements/topbar.php b/views/default/page/elements/topbar.php new file mode 100644 index 000000000..75df5fa93 --- /dev/null +++ b/views/default/page/elements/topbar.php @@ -0,0 +1,44 @@ +<?php +/** + * Elgg top toolbar + * The standard elgg top toolbar + */ + +$user = get_loggedin_user(); +if (($user instanceof ElggUser) && ($user->guid > 0)) { + echo '<div class="elgg-page-topbar">'; + echo '<div class="elgg-page-topbar-inner">'; + + // Elgg logo + echo '<a href="http://www.elgg.org">'; + echo "<img class=\"site-logo\" src=\"".elgg_get_site_url()."_graphics/elgg_toolbar_logo.gif\" alt=\"Elgg logo\" />"; + echo '</a>'; + + // avatar + $user_link = $user->getURL(); + $user_image = $user->getIcon('topbar'); + echo "<a href=\"$user_link\"><img class=\"user-mini-avatar\" src=\"$user_image\" alt=\"User avatar\" /></a>"; + + // logout link + echo elgg_view('page/elements/topbar_logout', $vars); + + // elgg tools menu + // need to echo this empty view for backward compatibility. + echo elgg_view("navigation/topbar_tools"); + + // enable elgg topbar extending + echo elgg_view('elgg_topbar/extend', $vars); + + // user settings + $settings = elgg_echo('settings'); + echo "<a href=\"".elgg_get_site_url()."pg/settings\" class=\"settings\">$settings</a>"; + + // The administration link is for admin or site admin users only + if ($user->isAdmin()) { + $admin = elgg_echo("admin"); + echo "<a href=\"".elgg_get_site_url()."pg/admin\" class=\"admin\">$admin</a>"; + } + + echo '</div>'; + echo '</div>'; +} diff --git a/views/default/page/elements/topbar_logout.php b/views/default/page/elements/topbar_logout.php new file mode 100644 index 000000000..2d2ecf67c --- /dev/null +++ b/views/default/page/elements/topbar_logout.php @@ -0,0 +1,14 @@ +<?php +/** + * A standard logout link + * + * Called within the Elgg topbar view. + */ + +echo '<div class="log-out">'; +echo elgg_view('output/url', array( + 'href' => "action/logout", + 'text' => elgg_echo('logout'), + 'is_action' => TRUE +)); +echo '</div>'; |