]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added breadcrumb support and updated the mods with old-style breadcrumbs.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 11 Mar 2010 18:07:26 +0000 (18:07 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 11 Mar 2010 18:07:26 +0000 (18:07 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5366 36083f99-b078-4883-b0ff-0f9b5a30f544

CHANGES.txt
engine/lib/elgglib.php
mod/bookmarks/add.php
mod/bookmarks/index.php
mod/groups/forum.php
mod/groups/views/default/forms/forums/addtopic.php
mod/groups/views/default/forum/viewposts.php
mod/messages/views/default/messages/messages.php
views/default/navigation/breadcrumbs.php [new file with mode: 0644]
views/default/page_elements/breadcrumbs.php [deleted file]
views/default/page_elements/content_header.php

index 8e0af58b3d908a8dc7c8ea66f9c4e6e2010a3aa0..d4f5507dc7a5749a17257915bdf6ab95c8360a1b 100644 (file)
@@ -2,7 +2,11 @@ Version 1.8.0
 (??? from http://code.elgg.org/branches/1.8/)
 
  API changes:
-  * added elgg_instanceof().
+  * Added elgg_instanceof().
+
+ UI/UX
+  * Added elgg_push_breadcrumb(), elgg_pop_breadcrumb(), and elgg_get_breadcrumbs().
+  * Added navigation/breadcrumbs.
 
 
 
index 42d6ffc6f88d8b991c0044dae07fbe8f27099a52..fd270bc1d4e48818c3b369fde0fd10e6d3406546 100644 (file)
@@ -2661,6 +2661,54 @@ function elgg_http_add_url_query_elements($url, array $elements) {
        return $string;
 }
 
+
+/**
+ * Breadcrumb support.
+ */
+
+/**
+ * Adds a breadcrumb to the stack
+ *
+ * @param string $title The title to display
+ * @param string $link Optional. The link for the title.
+ */
+function elgg_push_breadcrumb($title, $link = NULL) {
+       global $CONFIG;
+       if (!is_array($CONFIG->breadcrumbs)) {
+               $CONFIG->breadcrumbs = array();
+       }
+
+       // avoid key collisions.
+       $CONFIG->breadcrumbs[] = array('title' => $title, 'link' => $link);
+}
+
+/**
+ * Removes last breadcrumb entry.
+ *
+ * @return array popped item.
+ */
+function elgg_pop_breadcrumb() {
+       global $CONFIG;
+
+       if (is_array($CONFIG->breadcrumbs)) {
+               array_pop($CONFIG->breadcrumbs);
+       }
+
+       return FALSE;
+}
+
+/**
+ * Returns all breadcrumbs
+ *
+ * @return array Breadcrumbs
+ */
+function elgg_get_breadcrumbs() {
+       global $CONFIG;
+
+       return (is_array($CONFIG->breadcrumbs)) ? $CONFIG->breadcrumbs : array();
+}
+
+
 /**
  * Returns the PHP INI setting in bytes
  *
index 6f4ca7889a193edbae98e872e2502cb722a1807d..e5bc67a1aa57199ea19b294b09c6b5c40d8c40fd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Elgg bookmarks plugin add bookmark page
- * 
+ *
  * @package ElggBookmarks
  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
  * @author Curverider <info@elgg.com>
@@ -13,10 +13,10 @@ global $CONFIG;
 
 // Start engine
 require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-               
+
 // You need to be logged in for this one
 gatekeeper();
-               
+
 // Get the current page's owner
 $page_owner = page_owner_entity();
 if ($page_owner === false || is_null($page_owner)) {
@@ -25,17 +25,16 @@ if ($page_owner === false || is_null($page_owner)) {
 }
 if ($page_owner instanceof ElggGroup)
        $container = $page_owner->guid;
-                       
+
 //set up breadcrumbs
-$area1 .= elgg_view('page_elements/breadcrumbs', array( 
-               'breadcrumb_root_url' => $CONFIG->wwwroot."mod/bookmarks/all.php",
-               'breadcrumb_root_text' => elgg_echo('bookmarks:all'),
-               'breadcrumb_currentpage' => elgg_echo("bookmarks:add")
-               )); 
-       
+elgg_push_breadcrumb(elgg_echo('bookmarks:all'), $CONFIG->wwwroot."mod/bookmarks/all.php");
+elgg_push_breadcrumb(elgg_echo("bookmarks:add"));
+
+$area1 .= elgg_view('navigation/breadcrumbs');
+
 // get the filter menu
 $area1 .= elgg_view('page_elements/content_header', array('context' => "action", 'type' => 'bookmarks'));
-                       
+
 // If we've been given a bookmark to edit, grab it
 if ($this_guid = get_input('bookmark',0)) {
        $entity = get_entity($this_guid);
@@ -48,12 +47,12 @@ if ($this_guid = get_input('bookmark',0)) {
 
 $area3 = elgg_view('bookmarks/ownerblock');
 // if logged in, get the bookmarklet
-$area3 .= elgg_view("bookmarks/bookmarklet");          
+$area3 .= elgg_view("bookmarks/bookmarklet");
 //include a view for plugins to extend
-$area3 .= elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks')); 
-               
+$area3 .= elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks'));
+
 // Format page
 $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3);
-               
+
 // Draw it
 echo page_draw(elgg_echo('bookmarks:add'),$body);
\ No newline at end of file
index baff805bfcb9bcc8cc3200e702611c4b31bc74bd..55f8541219c52edfbc5a67f0e7026657bfc14065 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Elgg bookmarks plugin index page
- * 
+ *
  * @package ElggBookmarks
  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
  * @author Curverider <info@elgg.com>
@@ -19,20 +19,18 @@ if ($page_owner === false || is_null($page_owner)) {
        $page_owner = $_SESSION['user'];
        set_page_owner($page_owner->getGUID());
 }
-               
+
+elgg_push_breadcrumb(elgg_echo('bookmarks:all'), $CONFIG->wwwroot."mod/bookmarks/all.php");
+elgg_push_breadcrumb(sprintf(elgg_echo("bookmarks:user"),$page_owner->name));
+
 //set bookmarks header
-if(page_owner()== get_loggedin_user()->guid){
+if(page_owner() == get_loggedin_userid()) {
        $area1 .= elgg_view('page_elements/content_header', array('context' => "own", 'type' => 'bookmarks'));
-}else{
-       $area1 .= elgg_view('page_elements/breadcrumbs', array( 
-                                       'breadcrumb_root_url' => $CONFIG->wwwroot."mod/bookmarks/all.php",
-                                       'breadcrumb_root_text' => elgg_echo('bookmarks:all'),
-                                       'breadcrumb_currentpage' => sprintf(elgg_echo("bookmarks:user"),$page_owner->name)
-                                       )); 
-
+} else {
+       $area1 .= elgg_view('navigation/breadcrumbs');
        $area1 .= elgg_view('page_elements/content_header_member', array('type' => 'bookmarks'));
 }
-                       
+
 // List bookmarks
 set_context('search');
 $bookmarks = list_entities('object','bookmarks',page_owner());
@@ -44,16 +42,16 @@ set_context('bookmarks');
 //if the logged in user is not looking at their stuff, display the ownerblock
 if(page_owner()        != get_loggedin_user()->guid){
        $area3 = elgg_view('bookmarks/ownerblock');
-}else{ 
+}else{
        if(isloggedin()){
                // if logged in, get the bookmarklet
                $area3 .= elgg_view("bookmarks/bookmarklet");
-       }               
+       }
 }
 //include a view for plugins to extend
-$area3 .= elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks')); 
+$area3 .= elgg_view("bookmarks/sidebar_options", array("object_type" => 'bookmarks'));
 // Format page
 $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3);
-               
+
 // Draw it
 echo page_draw(sprintf(elgg_echo("bookmarks:user"),page_owner_entity()->name), $body);
\ No newline at end of file
index 12c84adb5c9d1e124276346ce9032e76e236c2d9..f59c3ed30c96e2ef379a6cce2012c1b71cc460ab 100644 (file)
@@ -1,7 +1,7 @@
 <?php
        /**
         * Elgg groups forum
-        * 
+        *
         * @package ElggGroups
         * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
         * @author Curverider
         */
 
        require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       
+
        set_page_owner((int)get_input('group_guid'));
        if (!(page_owner_entity() instanceof ElggGroup)) forward();
-       
+
        group_gatekeeper();
-       
-       //get any forum topics
+
        //get any forum topics
        $topics = list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 20, 0, get_input('group_guid'), false, false, false);
-       set_context('search');  
-       
-       //set up breadcrumbs
-       $area1 = elgg_view('page_elements/breadcrumbs', array( 
-               'breadcrumb_root_url' => '',
-               'breadcrumb_root_text' => 'Parent Group Name',
-               'breadcrumb_currentpage' => elgg_echo('item:object:groupforumtopic')
-               ));
-       
-       
+       set_context('search');
+
+       // set up breadcrumbs
+       elgg_push_breadcrumb('Parent Group Name');
+       elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'));
+
        $area1 .= elgg_view("forum/topics", array('topics' => $topics));
        set_context('groups');
-       
+
        $body = elgg_view_layout('one_column_with_sidebar', $area1);
-       
+
        $title = elgg_echo('item:object:groupforumtopic');
-       
+
        // Finally draw the page
        page_draw($title, $body);
 
index 37075aa6d9df714e9a6358fa45dd659d9a896138..e3bc3e1c65009ad513689fbf84b5dd5de50eaeb6 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 /**
  * Elgg Groups topic edit/add page
- * 
+ *
  * @package ElggGroups
  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
  * @author Curverider <info@elgg.com>
  * @copyright Curverider Ltd 2008-2010
  * @link http://elgg.com/
- * 
+ *
  * @uses $vars['object'] Optionally, the topic to edit
  */
 
        $message_id = "";
        $status = "";
        $access_id = ACCESS_DEFAULT;
-           
-    // get the group guid
-    $group_guid = (int) get_input('group_guid');
-     
-       // set breadcrumbs   
-       echo elgg_view('page_elements/breadcrumbs', array( 
-               'breadcrumb_root_url' => '',
-               'breadcrumb_root_text' => 'Parent Group Name',
-               'breadcrumb_level1_url' => '#',
-               'breadcrumb_level1_text' => elgg_echo('item:object:groupforumtopic'),
-               'breadcrumb_currentpage' => elgg_echo("groups:addtopic")
-               ));
-        
+
+       // get the group guid
+       $group_guid = (int) get_input('group_guid');
+
+       // set breadcrumbs
+       elgg_push_breadcrumb('', 'Parent Group Name');
+       elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), '');
+       elgg_push_breadcrumb(elgg_echo("groups:addtopic"));
+
+       echo elgg_view('navigation/breadcrumbs');
+
        // set the title
        echo elgg_view_title(elgg_echo("groups:addtopic"));
-           
+
 ?>
 <!-- display the input form -->
 <form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" method="post" class="margin_top">
@@ -44,7 +42,7 @@
        <p>
                <label><?php echo elgg_echo("title"); ?><br />
                <?php
-            //display the topic title input
+                       //display the topic title input
                        echo elgg_view("input/text", array(
                                                                "internalname" => "topictitle",
                                                                "value" => $title,
@@ -52,7 +50,7 @@
                ?>
                </label>
        </p>
-       
+
        <!-- display the tag input -->
        <p>
                <label><?php echo elgg_echo("tags"); ?><br />
                                                                "internalname" => "topictags",
                                                                "value" => $tags,
                                                                                                ));
-               
+
                ?>
                </label>
        </p>
-       
+
        <!-- topic message input -->
        <p class="longtext_editarea">
                <label><?php echo elgg_echo("groups:topicmessage"); ?><br />
                ?>
                </label>
        </p>
-       
+
        <!-- set the topic status -->
        <p>
-           <label><?php echo elgg_echo("groups:topicstatus"); ?><br />
-           <select name="status">
-               <option value="open" <?php if($status == "") echo "SELECTED";?>><?php echo elgg_echo('groups:topicopen'); ?></option>
-               <option value="closed" <?php if($status == "closed") echo "SELECTED";?>><?php echo elgg_echo('groups:topicclosed'); ?></option>
-           </select>
-           </label>
+               <label><?php echo elgg_echo("groups:topicstatus"); ?><br />
+               <select name="status">
+                       <option value="open" <?php if($status == "") echo "SELECTED";?>><?php echo elgg_echo('groups:topicopen'); ?></option>
+                       <option value="closed" <?php if($status == "closed") echo "SELECTED";?>><?php echo elgg_echo('groups:topicclosed'); ?></option>
+               </select>
+               </label>
        </p>
-       
+
        <!-- access -->
        <p>
                <label>
@@ -97,7 +95,7 @@
                        <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
                </label>
        </p>
-       
+
        <!-- required hidden info and submit button -->
        <p>
                <input type="hidden" name="group_guid" value="<?php echo $group_guid; ?>" />
index efb7e595cb0bf76cc01286f9d506168d32f5423e..02ed06b621ecfee3373eb3e3ee1bf9f4dd5fe538 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-    /**
+       /**
         * Elgg groups plugin display topic posts
-        * 
+        *
         * @package ElggGroups
         * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
         * @author Curverider
         * @link http://elgg.com/
         */
 
-?>
+       elgg_push_breadcrumb('', 'Parent Group Name');
+       elgg_push_breadcrumb(elgg_echo('item:object:groupforumtopic'), '');
+       elgg_push_breadcrumb($vars['entity']->title);
 
-<?php
-       echo elgg_view('page_elements/breadcrumbs', array( 
-               'breadcrumb_root_url' => '',
-               'breadcrumb_root_text' => 'Parent Group Name',
-               'breadcrumb_level1_url' => '#',
-               'breadcrumb_level1_text' => elgg_echo('item:object:groupforumtopic'),
-               'breadcrumb_currentpage' => $vars['entity']->title
-               ));
+       echo elgg_view('navigation/breadcrumbs');
 
+       //display follow up comments
+       $count = $vars['entity']->countAnnotations('group_topic_post');
+       $offset = (int) get_input('offset',0);
 
-    //display follow up comments
-    $count = $vars['entity']->countAnnotations('group_topic_post');
-    $offset = (int) get_input('offset',0);
-    
-    $baseurl = $vars['url'] . "mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$vars['entity']->container_guid}";
-    echo elgg_view('navigation/pagination',array(
-                                                                                               'limit' => 50,
-                                                                                               'offset' => $offset,
-                                                                                               'baseurl' => $baseurl,
-                                                                                               'count' => $count,
-                                                                                       ));
+       $baseurl = $vars['url'] . "mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$vars['entity']->container_guid}";
+       echo elgg_view('navigation/pagination',array(
+                                                                                                       'limit' => 50,
+                                                                                                       'offset' => $offset,
+                                                                                                       'baseurl' => $baseurl,
+                                                                                                       'count' => $count,
+                                                                                               ));
 
 ?>
 <!-- grab the topic title -->
 <h2><?php echo $vars['entity']->title; ?></h2>
 <?php
-                                                                                       
-    foreach($vars['entity']->getAnnotations('group_topic_post', 50, $offset, "asc") as $post) {
-                   
-            echo elgg_view("forum/topicposts",array('entity' => $post));
-               
+
+       foreach($vars['entity']->getAnnotations('group_topic_post', 50, $offset, "asc") as $post) {
+
+               echo elgg_view("forum/topicposts",array('entity' => $post));
+
        }
-       
+
        // check to find out the status of the topic and act
-    if($vars['entity']->status != "closed" && page_owner_entity()->isMember($vars['user'])){
-        
-        //display the add comment form, this will appear after all the existing comments
-           echo elgg_view("forms/forums/addpost", array('entity' => $vars['entity']));
-           
-    } elseif($vars['entity']->status == "closed") {
-        
-        //this topic has been closed by the owner
-        echo "<h2>" . elgg_echo("groups:topicisclosed") . "</h2>";
-        echo "<p>" . elgg_echo("groups:topiccloseddesc") . "</p>";
-        
-    } else {
-    }
+       if($vars['entity']->status != "closed" && page_owner_entity()->isMember($vars['user'])){
+
+               //display the add comment form, this will appear after all the existing comments
+               echo elgg_view("forms/forums/addpost", array('entity' => $vars['entity']));
+
+       } elseif($vars['entity']->status == "closed") {
+
+               //this topic has been closed by the owner
+               echo "<h2>" . elgg_echo("groups:topicisclosed") . "</h2>";
+               echo "<p>" . elgg_echo("groups:topiccloseddesc") . "</p>";
+
+       } else {
+       }
 
 ?>
index 5c2630ad628f3d3bc873cef229a6496116f4e3b2..29178bf6db4963159bdedc0f9e97d4f4663a2e14 100644 (file)
 if(get_input("type") == "sent"){
        // send back to the users sentbox
        $url = $vars['url'] . "mod/messages/sent.php";
-    // set up breadcrumbs context
-    $breadcrumb_root_text = elgg_echo('messages:sent');
+       // set up breadcrumbs context
+       elgg_push_breadcrumb(elgg_echo('messages:sent'), $url);
        //this is used on the delete link so we know which type of message it is
        $type = "sent";
 } else {
        //send back to the users inbox
        $url = $vars['url'] . "pg/messages/" . $vars['user']->username;
-    // set up breadcrumbs context
-    $breadcrumb_root_text = elgg_echo('messages:inbox');
+       // set up breadcrumbs context
+       elgg_push_breadcrumb(elgg_echo('messages:inbox'), $url);
        //this is used on the delete link so we know which type of message it is
        $type = "inbox";
 }
@@ -41,11 +41,8 @@ if (isloggedin())
                if ($vars['entity']->toId == $vars['user']->guid
                        || $vars['entity']->owner_guid == $vars['user']->guid) {
                        // display breadcrumbs
-                       echo elgg_view('page_elements/breadcrumbs', array( 
-                               'breadcrumb_root_url' => $url,
-                               'breadcrumb_root_text' => $breadcrumb_root_text,
-                               'breadcrumb_currentpage' => $vars['entity']->title
-                               ));
+                       elgg_push_breadcrumb($vars['entity']->title);
+                       echo elgg_view('navigation/breadcrumbs');
 ?>
 <!-- display the content header block -->
                        <div id="content_header" class="clearfloat">
@@ -57,45 +54,45 @@ if (isloggedin())
                                                'text' => elgg_echo('delete'),
                                                'confirm' => elgg_echo('deleteconfirm'),
                                                'class' => "action_button disabled"
-                                               )); 
+                                               ));
                                ?>
                                </div>
                        </div>
-                   
-                       <div class="entity_listing messages clearfloat">
-                           <?php
-                               // we need a different user icon and name depending on whether the user is reading the message
-                               // from their inbox or sentbox. If it is the inbox, then the icon and name will be the person who sent
-                               // the message. If it is the sentbox, the icon and name will be the user the message was sent to
-                               if($type == "sent"){
-                                   //get an instance of the user who the message has been sent to so we can access the name and icon
-                                   $user_object = get_entity($vars['entity']->toId);
-                                   $message_icon = elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
-                                   $message_owner = elgg_echo('messages:to').": <a href='{$vars['url']}pg/profile/".$user_object->username."'>".$user_object->name."</a>";
-                               }else{
-                                       $user_object = get_entity($vars['entity']->fromId);
-                                   $message_icon = elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
-                                   $message_owner = elgg_echo('messages:from').": <a href='{$vars['url']}pg/profile/".$user_object->username."'>".get_entity($vars['entity']->fromId)->name."</a>";
-                               }
-                           ?>
-                           <div class="entity_listing_icon"><?php echo $message_icon ?></div>
-                           <div class="entity_listing_info"><p><?php echo $message_owner ?></p>
+
+                               <div class="entity_listing messages clearfloat">
+                                       <?php
+                                               // we need a different user icon and name depending on whether the user is reading the message
+                                               // from their inbox or sentbox. If it is the inbox, then the icon and name will be the person who sent
+                                               // the message. If it is the sentbox, the icon and name will be the user the message was sent to
+                                               if($type == "sent"){
+                                                       //get an instance of the user who the message has been sent to so we can access the name and icon
+                                                       $user_object = get_entity($vars['entity']->toId);
+                                                       $message_icon = elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
+                                                       $message_owner = elgg_echo('messages:to').": <a href='{$vars['url']}pg/profile/".$user_object->username."'>".$user_object->name."</a>";
+                                               }else{
+                                                       $user_object = get_entity($vars['entity']->fromId);
+                                                       $message_icon = elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
+                                                       $message_owner = elgg_echo('messages:from').": <a href='{$vars['url']}pg/profile/".$user_object->username."'>".get_entity($vars['entity']->fromId)->name."</a>";
+                                               }
+                                       ?>
+                                       <div class="entity_listing_icon"><?php echo $message_icon ?></div>
+                                       <div class="entity_listing_info"><p><?php echo $message_owner ?></p>
                                                <p class="entity_subtext"><?php echo friendly_time($vars['entity']->time_created); ?></p>
                                        </div>
-                       </div>
-                       
-                       <div class="messagebody margin_top clearfloat">        
-                               <?php
-                                           // if the message is a reply, display the message the reply was for
-                                           // @todo I need to figure out how to get the description out using -> (anyone?)
-                                           if($main_message = $vars['entity']->getEntitiesFromRelationship("reply")){
-                                           echo $main_message[0][description];
-                                   }
-                               ?>
+                               </div>
+
+                               <div class="messagebody margin_top clearfloat">
+                                       <?php
+                                               // if the message is a reply, display the message the reply was for
+                                               // @todo I need to figure out how to get the description out using -> (anyone?)
+                                               if($main_message = $vars['entity']->getEntitiesFromRelationship("reply")){
+                                                       echo $main_message[0][description];
+                                               }
+                                       ?>
                                        <!-- display the message -->
                                        <?php echo elgg_view('output/longtext',array('value' => $vars['entity']->description)); ?>
                                </div>
-               
+
                                <!-- reply form -->
                                <div id="message_reply_form" class="hidden margin_top">
                                        <h2><?php echo elgg_echo('messages:answer'); ?></h2>
@@ -108,8 +105,8 @@ if (isloggedin())
                                                                                        "internalname" => "message",
                                                                                        "value" => '',
                                                                                                                        ));
-                                       ?></div>
-                                               
+                                               ?></div>
+
                                        <?php
                                                //pass across the guid of the message being replied to
                                                echo "<input type='hidden' name='reply' value='" . $vars['entity']->getGUID() . "' />";
diff --git a/views/default/navigation/breadcrumbs.php b/views/default/navigation/breadcrumbs.php
new file mode 100644 (file)
index 0000000..1dc97f2
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Displays registered breadcrumbs.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ *
+ * @uses optional $vars['breadcrumbs'] = array('title' => 'The title', 'link' => 'url')
+ *
+ */
+
+if (isset($vars['breadcrumbs'])) {
+       $breadcrumbs = $vars['breadcrumbs'];
+} else {
+       $breadcrumbs = elgg_get_breadcrumbs();
+}
+
+$formatted_breadcrumbs = array();
+
+foreach ($breadcrumbs as $breadcrumb) {
+       $link = $breadcrumb['link'];
+       $title = $breadcrumb['title'];
+
+       if (!empty($link)) {
+               $formatted_breadcrumbs[] = elgg_view('output/url', array(
+                       'href' => $link,
+                       'text' => $title
+               ));
+       } else {
+               $formatted_breadcrumbs[] = $title;
+       }
+}
+
+$breadcrumbs_html = implode(' &gt; ', $formatted_breadcrumbs);
+
+echo <<<___END
+
+<div id="breadcrumbs">
+       $breadcrumbs_html
+</div>
+
+___END;
+?>
\ No newline at end of file
diff --git a/views/default/page_elements/breadcrumbs.php b/views/default/page_elements/breadcrumbs.php
deleted file mode 100644 (file)
index 165a6c7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php\r
-\r
-/**\r
- * Breadcrumbs\r
-**/\r
-// @todo spk to Brett re. making this simpler / scalable\r
-// grab variables from array\r
-$breadcrumb_root_url = $vars['breadcrumb_root_url'];\r
-$breadcrumb_root_text = $vars['breadcrumb_root_text'];\r
-$breadcrumb_level1_url = $vars['breadcrumb_level1_url'];\r
-$breadcrumb_level1_text = $vars['breadcrumb_level1_text'];\r
-$breadcrumb_level2_url = $vars['breadcrumb_level2_url'];\r
-$breadcrumb_level2_text = $vars['breadcrumb_level2_text'];\r
-$breadcrumb_currentpage = $vars['breadcrumb_currentpage']; \r
-?>\r
-<div id="breadcrumbs">\r
-       <a href="<?php echo $breadcrumb_root_url; ?>"><?php echo $breadcrumb_root_text; ?></a> &gt;\r
-       <?php\r
-               if (isset($vars['breadcrumb_level1_url']) && $vars['breadcrumb_level1_url']) { ?>\r
-               <a href="<?php echo $breadcrumb_level1_url; ?>"><?php echo $breadcrumb_level1_text; ?></a> &gt;\r
-       <?php } \r
-               if (isset($vars['breadcrumb_level2_url']) && $vars['breadcrumb_level2_url']) { ?>       \r
-               <a href="<?php echo $breadcrumb_level2_url; ?>"><?php echo $breadcrumb_level2_text; ?></a> &gt; \r
-       <?php }\r
-       echo $breadcrumb_currentpage; ?>\r
-</div>
\ No newline at end of file
index 9d7bea08ae104c7452e4488c7bfbfe7d123a282f..95e754d59ab7cbe80d9c2e7c1c4ea49fc5d47e8b 100644 (file)
@@ -1,44 +1,51 @@
 <?php
 /**
- *     Page Content header 
-       holds the filter menu and any content action buttons
-       used on  bookmarks, blog, file, pages,
- **/
-        
+ * Displays the dropdown filter menu.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ *
+ */
+
 global $CONFIG;
-       
+
 // set variables
 $page_owner = page_owner_entity();
+if (!$page_owner) {
+       $page_owner = get_loggedin_user();
+}
 $filter_context = $vars['context']; // so we know if the user is looking at their own, everyone's or all friends
-$type = $vars['type']; // get the object type 
+$type = $vars['type']; // get the object type
 $mine_selected = '';
 $all_selected = '';
 $friend_selected = '';
 $action_buttons = '';
 $title = '';
 /* $dash_selected = ''; */
-                                       
-if(!($page_owner instanceof ElggGroup)){
+
+if (!($page_owner instanceof ElggGroup)){
        if($filter_context == 'mine') {
                $mine_selected = "SELECTED";
        }
        if($filter_context == 'everyone') {
-               $all_selected = "SELECTED";     
+               $all_selected = "SELECTED";
        }
        if($filter_context == 'friends') {
                $friend_selected = "SELECTED";
        }
-       if($filter_context == 'action') { 
+       if($filter_context == 'action') {
                // if this is an action page, we'll not be displaying the filter
        }
 /*
-       if($filter_context == 'dashboard') 
+       if($filter_context == 'dashboard')
                $dash_selected = "SELECTED";
 */
-}      
+}
 
 // must be logged in to see the filter menu and any action buttons
-if(isloggedin()) {
+if (isloggedin()) {
        // if we're not on an action page (add bookmark, create page, upload a file etc)
        if ($filter_context != 'action') {
                $location_filter = "<select onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\" name=\"file_filter\" class='styled' >";
@@ -47,10 +54,10 @@ if(isloggedin()) {
                $location_filter .= "<option {$friend_selected} class='select_option' value=\"{$vars['url']}pg/{$type}/{$_SESSION['user']->username}/friends/\">". elgg_echo($type . ':friends') . "</option>";
                $location_filter .= "</select>";
                $location_filter = "<div class='content_header_filter'>".$location_filter."</div>";
-               
+
                // action buttons
                if(get_context() != 'bookmarks'){
-                       $url = $CONFIG->wwwroot . "pg/{$type}/". $page_owner->username . "/new/";
+                       $url = $CONFIG->wwwroot . "pg/{$type}/". $page_owner->username . "/new";
                } else {
                        $url = $CONFIG->wwwroot . "pg/{$type}/". $page_owner->username . "/add";
                }
@@ -61,7 +68,7 @@ if(isloggedin()) {
                // if we're on an action page - we'll just have a simple page title, and no filter menu
                $title = "<div class='content_header_title'>".elgg_view_title($title = elgg_echo($type . ':add'))."</div>";
        }
-}      
+}
 ?>
 <!-- construct the content area header -->
 <div id="content_header" class="clearfloat">