aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'mod/pages/views/default')
-rw-r--r--mod/pages/views/default/annotation/icon.php32
-rw-r--r--mod/pages/views/default/annotation/page.php40
-rw-r--r--mod/pages/views/default/forms/pages/edit.php66
-rw-r--r--mod/pages/views/default/forms/pages/editwelcome.php57
-rw-r--r--mod/pages/views/default/object/page.php21
-rw-r--r--mod/pages/views/default/object/page_top.php21
-rw-r--r--mod/pages/views/default/pages/breadcrumbs.php28
-rw-r--r--mod/pages/views/default/pages/css.php108
-rw-r--r--mod/pages/views/default/pages/groupprofile_pages.php9
-rw-r--r--mod/pages/views/default/pages/menu.php14
-rw-r--r--mod/pages/views/default/pages/metatags.php22
-rw-r--r--mod/pages/views/default/pages/pagegallery.php37
-rw-r--r--mod/pages/views/default/pages/pagelisting.php38
-rw-r--r--mod/pages/views/default/pages/pageprofile.php66
-rw-r--r--mod/pages/views/default/pages/sidebar/sidebarthis.php82
-rw-r--r--mod/pages/views/default/pages/sidebar/starter.php21
-rw-r--r--mod/pages/views/default/pages/sidebar/tree.php8
-rw-r--r--mod/pages/views/default/pages/sidebar/wrapper.php7
-rw-r--r--mod/pages/views/default/pages/welcome.php29
19 files changed, 706 insertions, 0 deletions
diff --git a/mod/pages/views/default/annotation/icon.php b/mod/pages/views/default/annotation/icon.php
new file mode 100644
index 000000000..cb2548cb2
--- /dev/null
+++ b/mod/pages/views/default/annotation/icon.php
@@ -0,0 +1,32 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+
+ $annotation = $vars['annotation'];
+ $entity = get_entity($annotation->entity_guid);
+
+ // Get size
+ if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar')))
+ $vars['size'] = "medium";
+
+ // Get any align and js
+ if (!empty($vars['align'])) {
+ $align = " align=\"{$vars['align']}\" ";
+ } else {
+ $align = "";
+ }
+
+
+?>
+
+<div class="groupicon">
+<a href="<?php echo $entity->getURL() . "?rev=" . $annotation->id; ?>"><img src="<?php echo $vars['url']; ?>mod/pages/graphics/default<?php echo $vars['size']; ?>.jpg" border="0" <?php echo $align; ?> <?php echo $vars['js']; ?> /></a>
+</div> \ No newline at end of file
diff --git a/mod/pages/views/default/annotation/page.php b/mod/pages/views/default/annotation/page.php
new file mode 100644
index 000000000..ff06178ec
--- /dev/null
+++ b/mod/pages/views/default/annotation/page.php
@@ -0,0 +1,40 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $annotation = $vars['annotation'];
+ $entity = get_entity($annotation->entity_guid);
+
+ $icon = elgg_view(
+ "annotation/icon", array(
+ 'annotation' => $vars['annotation'],
+ 'size' => 'small',
+ )
+ );
+
+ $owner_guid = $annotation->owner_guid;
+ $owner = get_entity($owner_guid);
+
+ $rev = sprintf(elgg_echo('pages:revision'),
+ friendly_time($annotation->time_created),
+
+ "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"
+ );
+
+ $link = $entity->getURL() . "?rev=" . $annotation->id;
+
+ $info = <<< END
+
+<div><a href="$link">{$entity->title}</a></div>
+<div>$rev</div>
+END;
+
+ echo elgg_view_listing($icon, $info);
+?> \ No newline at end of file
diff --git a/mod/pages/views/default/forms/pages/edit.php b/mod/pages/views/default/forms/pages/edit.php
new file mode 100644
index 000000000..8c9e5ccfc
--- /dev/null
+++ b/mod/pages/views/default/forms/pages/edit.php
@@ -0,0 +1,66 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $parent_guid = get_input('parent_guid');
+ $container_guid = get_input('container_guid');
+ if (!$container_guid) $container_guid = page_owner();
+?>
+<form action="<?php echo $vars['url']; ?>action/pages/edit" method="post">
+
+<?php
+
+ //var_export($vars['profile']);
+ if (is_array($vars['config']->pages) && sizeof($vars['config']->pages) > 0)
+ foreach($vars['config']->pages as $shortname => $valtype) {
+
+ $disabled = "";
+
+ if (($vars['entity']) && ($shortname == 'title'))
+ {
+ $disabled = true;
+ }
+?>
+
+ <p>
+ <label>
+ <?php echo elgg_echo("pages:{$shortname}") ?><br />
+ <?php echo elgg_view("input/{$valtype}",array(
+ 'internalname' => $shortname,
+ 'value' => $vars['entity']->$shortname,
+ 'disabled' => $disabled
+ )); ?>
+ </label>
+ </p>
+
+<?php
+
+ }
+
+?>
+ <p>
+ <?php
+ if ($vars['entity'])
+ {
+ ?><input type="hidden" name="pages_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /><?php
+ }
+ ?>
+ <?php
+ if ($container_guid)
+ {
+ ?><input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" /><?php
+ }
+ ?>
+ <input type="hidden" name="parent_guid" value="<?php if ($vars['entity']) echo $vars['entity']->parent_guid; else echo $parent_guid; ?>" />
+ <input type="hidden" name="owner_guid" value="<?php if ($vars['entity']) echo $vars['entity']->owner_guid; else echo page_owner(); ?>" />
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />
+ </p>
+
+</form> \ No newline at end of file
diff --git a/mod/pages/views/default/forms/pages/editwelcome.php b/mod/pages/views/default/forms/pages/editwelcome.php
new file mode 100644
index 000000000..d8960bf9c
--- /dev/null
+++ b/mod/pages/views/default/forms/pages/editwelcome.php
@@ -0,0 +1,57 @@
+<?php
+ /**
+ * Elgg Pages Edit welcome page
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ //set some variables
+ if($vars['entity']){
+ foreach($vars['entity'] as $welcome){
+ $current_message = $welcome->description;
+ $object_guid = $welcome->guid;
+ $access_id = $welcome->access_id;
+ }
+ }else{
+ $current_message = '';
+ $object_guid = '';
+ $access_id = 0;
+ }
+
+ $page_owner = $vars['owner']->guid;
+
+?>
+<form action="<?php echo $vars['url']; ?>action/pages/editwelcome" method="post">
+
+ <p>
+ <label>
+ <?php echo elgg_view("input/longtext",array(
+ 'internalname' => "pages_welcome",
+ 'value' => $current_message,
+ 'disabled' => $disabled
+ )); ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <?php echo elgg_echo('access'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </label>
+ </p>
+ <input type="hidden" name="owner_guid" value="<?php echo $page_owner; ?>" />
+
+ <?php
+ //if it is editing, include the object guid
+ if($object_guid != ''){
+ ?>
+ <input type="hidden" name="object_guid" value="<?php echo $object_guid; ?>" />
+ <?php
+ }
+ ?>
+
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />
+</form>
diff --git a/mod/pages/views/default/object/page.php b/mod/pages/views/default/object/page.php
new file mode 100644
index 000000000..6a872f3ae
--- /dev/null
+++ b/mod/pages/views/default/object/page.php
@@ -0,0 +1,21 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ if ($vars['full']) {
+ echo elgg_view("pages/pageprofile",$vars);
+ } else {
+ if (get_input('search_viewtype') == "gallery") {
+ echo elgg_view('pages/pagegallery',$vars);
+ } else {
+ echo elgg_view("pages/pagelisting",$vars);
+ }
+ }
+?> \ No newline at end of file
diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php
new file mode 100644
index 000000000..6a872f3ae
--- /dev/null
+++ b/mod/pages/views/default/object/page_top.php
@@ -0,0 +1,21 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ if ($vars['full']) {
+ echo elgg_view("pages/pageprofile",$vars);
+ } else {
+ if (get_input('search_viewtype') == "gallery") {
+ echo elgg_view('pages/pagegallery',$vars);
+ } else {
+ echo elgg_view("pages/pagelisting",$vars);
+ }
+ }
+?> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/breadcrumbs.php b/mod/pages/views/default/pages/breadcrumbs.php
new file mode 100644
index 000000000..52662b5bd
--- /dev/null
+++ b/mod/pages/views/default/pages/breadcrumbs.php
@@ -0,0 +1,28 @@
+<?php
+
+ $page_owner = $vars['page_owner'];
+ $parent = $vars['parent'];
+
+ $breadcrumbs = '';
+
+ $owner_url = $CONFIG->wwwroot . "pg/pages/owned/" . get_entity($page_owner)->username;
+ echo "<div id=\"pages_breadcrumbs\"><b><a href=\"{$owner_url}\">" . elgg_echo('pages:user') . "</a></b>";
+
+ //see if the new page's parent has a parent
+ $getparent = get_entity($parent->parent_guid);
+ while ($getparent instanceof ElggObject){
+
+ $breadcrumbs = " &gt; <a href=\"{$getparent->getURL()}\">$getparent->title</a>" . $breadcrumbs;
+ $getparent = get_entity($getparent->parent_guid);
+
+ }
+
+ echo $breadcrumbs;
+ //if it is adding a page, make the last page a link, otherwise, don't
+ if($vars['add']){
+ echo " &gt; <a href=\"{$parent->getURL()}\">$parent->title</a></div>";
+ }else{
+ echo " &gt; $parent->title</div>";
+ }
+
+?> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/css.php b/mod/pages/views/default/pages/css.php
new file mode 100644
index 000000000..1fc1e5abb
--- /dev/null
+++ b/mod/pages/views/default/pages/css.php
@@ -0,0 +1,108 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+?>
+
+.treeview, .treeview ul {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+}
+
+.treeview ul {
+ background-color: white;
+ margin-top: 4px;
+}
+
+.treeview .hitarea {
+ background: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-default.gif) -64px -25px no-repeat;
+ height: 16px;
+ width: 16px;
+ margin-left: -16px;
+ float: left;
+ cursor: pointer;
+}
+/* fix for IE6 */
+* html .hitarea {
+ display: inline;
+ float:none;
+}
+
+.treeview li {
+ margin: 0;
+ padding: 3px 0pt 3px 16px;
+}
+
+.treeview a.selected {
+ background-color: #eee;
+}
+
+#treecontrol { margin: 1em 0; display: none; }
+
+.treeview .hover { color: red; cursor: pointer; }
+
+.treeview li { background: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-default-line.gif) 0 0 no-repeat; }
+.treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }
+
+.treeview .expandable-hitarea { background-position: -80px -3px; }
+
+.treeview li.last { background-position: 0 -1766px }
+.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-default.gif); }
+.treeview li.lastCollapsable { background-position: 0 -111px }
+.treeview li.lastExpandable { background-position: -32px -67px }
+
+.treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }
+
+.treeview-red li { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-red-line.gif); }
+.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-red.gif); }
+
+.treeview-black li { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-black-line.gif); }
+.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-black.gif); }
+
+.treeview-gray li { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-gray-line.gif); }
+.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-gray.gif); }
+
+.treeview-famfamfam li { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-famfamfam-line.gif); }
+.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(<?php echo $vars['url']; ?>mod/pages/images/treeview-famfamfam.gif); }
+
+
+.filetree li { padding: 3px 0 2px 16px; }
+.filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; }
+.filetree span.folder { background: url(<?php echo $vars['url']; ?>mod/pages/images/folder.gif) 0 0 no-repeat; }
+.filetree li.expandable span.folder { background: url(<?php echo $vars['url']; ?>mod/pages/images/folder-closed.gif) 0 0 no-repeat; }
+.filetree span.file { background: url(<?php echo $vars['url']; ?>mod/pages/images/file.gif) 0 0 no-repeat; }
+
+.pagesTreeContainer {
+ margin:0;
+ min-height: 200px;
+ }
+
+/* delete, Dave's test addition */
+
+#pages_page .strapline {
+ text-align:right;
+ border-top:1px solid #efefef;
+ margin:10px 0 10px 0;
+}
+
+#pages_page .tags {
+ padding:0 0 0 16px;
+ margin:10px 0 4px 0;
+ background:transparent url(<?php echo $vars['url']; ?>_graphics/icon_tag.gif) no-repeat scroll left 2px;
+}
+
+#pages_page img[align="left"] {
+ margin: 10px 20px 10px 0;
+ float:left;
+}
+#pages_page img[align="right"] {
+ margin: 10px 0 10px 10px;
+ float:right;
+}
+
diff --git a/mod/pages/views/default/pages/groupprofile_pages.php b/mod/pages/views/default/pages/groupprofile_pages.php
new file mode 100644
index 000000000..b32ccf3b0
--- /dev/null
+++ b/mod/pages/views/default/pages/groupprofile_pages.php
@@ -0,0 +1,9 @@
+<div id="group_pages_widget">
+<h2><?php echo elgg_echo("pages:groupprofile"); ?></h2>
+<?php
+
+ $objects = list_entities("object", "page_top", page_owner(), 5, false);
+ echo $objects;
+
+?>
+</div> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/menu.php b/mod/pages/views/default/pages/menu.php
new file mode 100644
index 000000000..ca8620f70
--- /dev/null
+++ b/mod/pages/views/default/pages/menu.php
@@ -0,0 +1,14 @@
+<?php
+ /**
+ * Elgg Pages: Add group menu
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+?>
+<p class="user_menu_pages">
+ <a href="<?php echo $vars['url']; ?>pg/pages/owned/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("pages"); ?></a>
+ </p> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/metatags.php b/mod/pages/views/default/pages/metatags.php
new file mode 100644
index 000000000..895df6657
--- /dev/null
+++ b/mod/pages/views/default/pages/metatags.php
@@ -0,0 +1,22 @@
+<?php
+
+ $treeguid = get_input('treeguid');
+ if (empty($treeguid)) {
+ $treeguid = get_input('page_guid');
+ }
+
+?>
+
+ <script type="text/javascript" src="<?php echo $vars['url']; ?>mod/pages/javascript/jquery.treeview.js" ></script>
+ <script type="text/javascript" src="<?php echo $vars['url']; ?>mod/pages/javascript/jquery.treeview.async.js" ></script>
+ <script type="text/javascript">
+
+ $(document).ready( function() {
+
+ $("#pagesTree").treeview({
+ url: "<?php echo $vars['url']; ?>mod/pages/pagesTree.php",
+ currentpage: "<?php echo get_input('page_guid'); ?>"
+ }, "<?php echo $treeguid; ?>")
+
+ });
+ </script>
diff --git a/mod/pages/views/default/pages/pagegallery.php b/mod/pages/views/default/pages/pagegallery.php
new file mode 100644
index 000000000..b49150927
--- /dev/null
+++ b/mod/pages/views/default/pages/pagegallery.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $icon = elgg_view(
+ "graphics/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'medium',
+ )
+ );
+
+ $info = "<div><p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->title . "</a></b></p></div>";
+
+
+ $latest = $vars['entity']->getAnnotations('page', 1, 0, 'desc');
+ if ($latest) {
+ $latest = $latest[0];
+
+ $time_updated = $latest->time_created;
+ $owner_guid = $latest->owner_guid;
+ $owner = get_entity($owner_guid);
+
+
+ $info .= "<br /><div>".
+ strip_tags(substr($latest->value, 0, 100))
+ . "</div>";
+ }
+
+ echo elgg_view_listing($icon, $info);
+?> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/pagelisting.php b/mod/pages/views/default/pages/pagelisting.php
new file mode 100644
index 000000000..a04e53bd4
--- /dev/null
+++ b/mod/pages/views/default/pages/pagelisting.php
@@ -0,0 +1,38 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $icon = elgg_view(
+ "graphics/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
+
+ $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->title . "</a></b></p>";
+
+
+ $latest = $vars['entity']->getAnnotations('page', 1, 0, 'desc');
+ if ($latest) {
+ $latest = $latest[0];
+
+ $time_updated = $latest->time_created;
+ $owner_guid = $latest->owner_guid;
+ $owner = get_entity($owner_guid);
+
+
+ $info .= "<p class=\"owner_timestamp\">".sprintf(elgg_echo("pages:strapline"),
+ friendly_time($time_updated),
+ "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"
+ ) . "</p>";
+ }
+
+ echo elgg_view_listing($icon, $info);
+?> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/pageprofile.php b/mod/pages/views/default/pages/pageprofile.php
new file mode 100644
index 000000000..e82e91728
--- /dev/null
+++ b/mod/pages/views/default/pages/pageprofile.php
@@ -0,0 +1,66 @@
+<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ // Output body
+ $entity = $vars['entity'];
+
+ $rev = (int)get_input('rev');
+
+ if ($rev)
+ {
+ $latest = get_annotation($rev);
+ }
+ else
+ {
+ $latest = $entity->getAnnotations('page', 1, 0, 'desc');
+ if ($latest) $latest = $latest[0];
+ }
+
+?>
+
+ <div id="pages_page">
+
+<?php
+ if ($entity)
+ {
+ echo elgg_view('output/longtext', array('value' => /*$entity->description*/ $latest->value));
+
+?>
+ <!-- display tags -->
+ <p class="tags">
+ <?php
+
+ echo elgg_view('output/tags', array('tags' => $vars['entity']->tags));
+
+ ?>
+ </p>
+
+<?php
+ }
+
+ // last edit & by whome
+?>
+
+ <p class="strapline">
+ <?php
+
+ $time_updated = $latest->time_created;
+ $owner_guid = $latest->owner_guid;
+ $owner = get_entity($owner_guid);
+
+ echo sprintf(elgg_echo("pages:strapline"),
+ friendly_time($time_updated),
+ "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"
+ );
+
+ ?>
+ </p>
+</div> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/sidebar/sidebarthis.php b/mod/pages/views/default/pages/sidebar/sidebarthis.php
new file mode 100644
index 000000000..ffdc6c802
--- /dev/null
+++ b/mod/pages/views/default/pages/sidebar/sidebarthis.php
@@ -0,0 +1,82 @@
+[<?php
+ /**
+ * Elgg Pages
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ 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()}\\\">{$childentity->title}</a>\",\n";
+
+ $haschild = get_entities_from_metadata('parent_guid',$childentity->guid,'','',0,9999);
+ if ($haschild) {
+ if (in_array($childentity->getGUID(),$path)) {
+ $child .= "\t\t\t\"expanded\": true,";
+ $child .= "\t\t\t\"children\": [\n";
+
+ $childstring = "";
+ foreach($haschild as $subchild) {
+ if (!empty($childstring)) $childstring .= ", ";
+ $childstring .= pages_draw_child($subchild,$path);
+ }
+
+ $child .= $childstring . "\n\t\t\t]\n";
+ } else {
+ $child .= "\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\n";
+ }
+
+ }
+ $child .= "\t\t}";
+ return $child;
+ }
+
+ if (!$parent) {
+ echo "{\n";
+ echo "\t\"text\": \"<a href=\\\"{$vars['entity']->getURL()}\\\">{$vars['entity']->title}</a>\",\n";
+ }
+ $children = "";
+ if (isset($vars['children']) && is_array($vars['children']) && (!isset($vars['fulltree']) || $vars['fulltree'] == 0)) {
+ if (!$parent) echo "\t" . '"expanded": true,' . "\n";
+ if (!$parent) echo "\t" . '"children": [' . "\n";
+ foreach($vars['children'] as $child) {
+ if (!empty($children)) $children .= ", \n";
+ /*
+ $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}";
+ */
+ $children .= pages_draw_child($child,$path);
+ }
+ 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
new file mode 100644
index 000000000..234ec28e5
--- /dev/null
+++ b/mod/pages/views/default/pages/sidebar/starter.php
@@ -0,0 +1,21 @@
+<?php
+
+ 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
new file mode 100644
index 000000000..1424eeebe
--- /dev/null
+++ b/mod/pages/views/default/pages/sidebar/tree.php
@@ -0,0 +1,8 @@
+<?php
+
+?>
+<div id="sidebar_page_tree">
+ <h3><?php echo elgg_echo("pages:navigation"); ?></h3>
+ <div id="pagesTree" class="pagesTreeContainer"></div>
+</div>
+<br class="clearfloat" /> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/sidebar/wrapper.php b/mod/pages/views/default/pages/sidebar/wrapper.php
new file mode 100644
index 000000000..08e6a5b7d
--- /dev/null
+++ b/mod/pages/views/default/pages/sidebar/wrapper.php
@@ -0,0 +1,7 @@
+<?php
+
+ echo "[";
+ echo $vars['body'];
+ echo "]";
+
+?> \ No newline at end of file
diff --git a/mod/pages/views/default/pages/welcome.php b/mod/pages/views/default/pages/welcome.php
new file mode 100644
index 000000000..0974ba151
--- /dev/null
+++ b/mod/pages/views/default/pages/welcome.php
@@ -0,0 +1,29 @@
+<?php
+
+ /**
+ * Elgg Pages welcome message
+ *
+ * @package ElggPages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ if($vars['entity']){
+
+ foreach($vars['entity'] as $welcome){
+
+ echo $welcome->description;
+
+ }
+
+ } else {
+
+?>
+
+ <p>Welcome to this Elgg pages plugin. This feature allows you to create pages on any topic and select who can view them and edit them.</p>
+
+<?php
+ }
+?> \ No newline at end of file