aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/views/default/pages/sidebar
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-22 20:33:28 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-22 20:33:28 +0000
commit8423cda014c6aee9fb3a3f7ebe78bc0465e7355f (patch)
treee1baa523308221d33908e4ea4014191ade8d5d66 /mod/pages/views/default/pages/sidebar
parentcec8a4f34681d4c2a43e0c07de0a68bc22f1b558 (diff)
downloadelgg-8423cda014c6aee9fb3a3f7ebe78bc0465e7355f.tar.gz
elgg-8423cda014c6aee9fb3a3f7ebe78bc0465e7355f.tar.bz2
finished the first pass on the pages plugin for using the new HTML/CSS
git-svn-id: http://code.elgg.org/elgg/trunk@7904 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/pages/views/default/pages/sidebar')
-rw-r--r--mod/pages/views/default/pages/sidebar/history.php19
-rw-r--r--mod/pages/views/default/pages/sidebar/navigation.php42
-rw-r--r--mod/pages/views/default/pages/sidebar/sidebarthis.php88
-rw-r--r--mod/pages/views/default/pages/sidebar/starter.php19
-rw-r--r--mod/pages/views/default/pages/sidebar/tree.php12
-rw-r--r--mod/pages/views/default/pages/sidebar/wrapper.php10
6 files changed, 61 insertions, 129 deletions
diff --git a/mod/pages/views/default/pages/sidebar/history.php b/mod/pages/views/default/pages/sidebar/history.php
new file mode 100644
index 000000000..f9de2c13d
--- /dev/null
+++ b/mod/pages/views/default/pages/sidebar/history.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * History of this page
+ *
+ * @uses $vars['page']
+ */
+
+$title = elgg_echo('pages:history');
+
+if ($vars['page']) {
+ $content = $content = list_annotations($vars['page']->guid, 'page', 20, false);
+}
+
+echo elgg_view('layout/objects/module', array(
+ 'title' => $title,
+ 'body' => $content,
+ 'class' => 'elgg-aside-module',
+));
+
diff --git a/mod/pages/views/default/pages/sidebar/navigation.php b/mod/pages/views/default/pages/sidebar/navigation.php
index ddd931dab..806fc2f52 100644
--- a/mod/pages/views/default/pages/sidebar/navigation.php
+++ b/mod/pages/views/default/pages/sidebar/navigation.php
@@ -1,16 +1,58 @@
<?php
/**
* Navigation menu for a user's or a group's pages
+ *
+ * @uses $vars['page'] Page object if manually setting selected item
*/
+$selected_page = elgg_get_array_value('page', $vars, false);
+if ($selected_page) {
+ $url = $selected_page->getURL();
+}
+
$title = elgg_echo('pages:navigation');
pages_register_navigation_tree(elgg_get_page_owner());
$content = elgg_view_menu('pages_nav', array('class' => 'pages-nav'));
+if (!$content) {
+ $content = '<p>' . elgg_echo('pages:none') . '</p>';
+}
echo elgg_view('layout/objects/module', array(
'title' => $title,
'body' => $content,
'class' => 'elgg-aside-module',
));
+
+?>
+<script type="text/javascript">
+$(document).ready(function() {
+ $(".pages-nav").treeview({
+ persist: "location",
+ collapsed: true,
+ unique: true
+ });
+
+<?php
+if ($selected_page) {
+ // if on a history page, we need to manually select the correct menu item
+ // code taken from the jquery.treeview library
+?>
+ var current = $(".pages-nav a[href='<?php echo $url; ?>']");
+ var items = current.addClass("selected").parents("ul, li").add( current.next() ).show();
+ var CLASSES = $.treeview.classes;
+ items.filter("li")
+ .swapClass( CLASSES.collapsable, CLASSES.expandable )
+ .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
+ .find(">.hitarea")
+ .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
+ .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea );
+<?php
+}
+?>
+
+});
+
+</script>
+
diff --git a/mod/pages/views/default/pages/sidebar/sidebarthis.php b/mod/pages/views/default/pages/sidebar/sidebarthis.php
deleted file mode 100644
index 173ddb91a..000000000
--- a/mod/pages/views/default/pages/sidebar/sidebarthis.php
+++ /dev/null
@@ -1,88 +0,0 @@
-[<?php
-/**
- * Side bar page tree.
- *
- * @package ElggPages
- */
-
-global $CONFIG;
-$entity = $vars['entity'];
-$parent = $vars['entity']->parent_guid;
-
-$currentpage = (int) get_input('currentpage');
-if ($currentpage) {
-
- $path = pages_get_path($currentpage);
- $pathstring = implode(',',$path);
-
-} else {
- $path = array();
-}
-
-function pages_draw_child($childentity, $path) {
-
- $child = "\n\t\t{\n";
- $child .= "\t\t\t\"text\": \"<a href=\\\"{$childentity->getURL()}\\\">" . addslashes($childentity->title) . "</a>\"\n";
-
- $extras = "";
- $haschild = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $childentity->guid, 'limit' => 9999));
- if ($haschild) {
- if (in_array($childentity->guid,$path)) {
- $extras .= "\t\t\t,\"expanded\": true";
- $extras .= "\t\t\t,\"children\": [\n";
-
- $childstring = "";
- foreach($haschild as $subchild) {
- $childstringtemp = pages_draw_child($subchild,$path);
- if (!empty($childstringtemp)) {
- if (!empty($childstring)) $childstring .= ", ";
- $childstring .= $childstringtemp;
- }
- }
-
- $extras .= $childstring . "\n\t\t\t]\n";
- } else {
- $extras .= ",\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\n";
- }
-
- }
- $child .= $extras . "\t\t}";
- return $child;
-}
-
-if (!$parent) {
- echo "{\n";
- echo "\t\"text\": \"<a href=\\\"{$vars['entity']->getURL()}\\\">" . addslashes($vars['entity']->title) . "</a>\"\n";
-}
-
- $children = "";
- $temp = "";
- if (isset($vars['children']) && is_array($vars['children']) && (!isset($vars['fulltree']) || $vars['fulltree'] == 0)) {
- if (!$parent) $temp .= "\t" . '"expanded": true,' . "\n";
- if (!$parent) $temp .= "\t" . '"children": [' . "\n";
- foreach($vars['children'] as $child) {
- $childrentemp = pages_draw_child($child,$path);
- if (!empty($childrentemp)) {
- if (!empty($children)) $children .= ", \n";
- $children .= $childrentemp;
- }
- /*
- $children .= "\n\t\t{\n";
- $children .= "\t\t\t\"text\": \"<a href=\\\"{$child->getURL()}\\\">{$child->title}</a>\",\n";
-
- $haschild = get_entities_from_metadata('parent_guid',$child->guid,'','',0,10,0,'',0,true);
- if ($haschild) {
- $children .= "\t\t\t\"id\": \"{$child->getGUID()}\",\n\t\t\t\"hasChildren\": true\n";
- }
- $children .= "\t\t}";
- */
- }
- if (!empty($temp)) echo ',' . $temp;
- echo $children;
- if (!$parent) echo "\t\t" . ']' . "\n";
-
- }
-
-if (!$parent) echo "}";
-
-?>] \ No newline at end of file
diff --git a/mod/pages/views/default/pages/sidebar/starter.php b/mod/pages/views/default/pages/sidebar/starter.php
deleted file mode 100644
index f533356b3..000000000
--- a/mod/pages/views/default/pages/sidebar/starter.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-/**
- * Start Pages page output
- *
- * @package ElggPages
- */
-
-if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) {
-
-?>
-
-<script type="text/javascript">
- $(document).ready( function() {
- $("#pagetree<?php echo $vars['entity']->getGUID(); ?>").click();
- });
-</script>
-
-<?php
-} \ No newline at end of file
diff --git a/mod/pages/views/default/pages/sidebar/tree.php b/mod/pages/views/default/pages/sidebar/tree.php
deleted file mode 100644
index 399caf108..000000000
--- a/mod/pages/views/default/pages/sidebar/tree.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * Side bar tree wrapper.
- *
- * @package ElggPages
- */
-?>
-<div id="sidebar_page_tree">
- <h3><?php echo elgg_echo("pages:navigation"); ?></h3>
- <div id="pagesTree" class="pagesTreeContainer"></div>
-</div>
-<br class="clearfloat" />
diff --git a/mod/pages/views/default/pages/sidebar/wrapper.php b/mod/pages/views/default/pages/sidebar/wrapper.php
deleted file mode 100644
index 93b746eb0..000000000
--- a/mod/pages/views/default/pages/sidebar/wrapper.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-/**
- * Pages page wrapper
- *
- * @package ElggPages
- */
-
-echo "[";
-echo $vars['body'];
-echo "]"; \ No newline at end of file