diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-03 17:53:05 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-03 17:53:05 +0000 |
commit | 4766f36a4d74924f21ff329c4318ce4e069ffa04 (patch) | |
tree | 969b84632f2a8b0db79788a8a6db8e41d63e5cb4 /mod/pages | |
parent | 57a217fd6b708844407486046a1faa23b46cac08 (diff) | |
download | elgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.gz elgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.bz2 |
Pulled in the interface changes.
git-svn-id: http://code.elgg.org/elgg/trunk@5257 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/pages')
89 files changed, 2358 insertions, 0 deletions
diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php new file mode 100644 index 000000000..740f1f6eb --- /dev/null +++ b/mod/pages/actions/pages/delete.php @@ -0,0 +1,35 @@ +<?php + + $page = get_input('page'); + + if ($page = get_entity($page)) { + + if ($page->canEdit()) { + + // Bring all child elements forward + $parent = $page->parent_guid; + if ($children = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $page->getGUID()))) { + foreach($children as $child) { + $child->parent_guid = $parent; + } + } + if ($page->delete()) { + system_message(elgg_echo('pages:delete:success')); + if ($parent) { + if ($parent = get_entity($parent)) { + forward($parent->getURL()); + exit; + } + } + forward('pg/pages/owned/' . $_SESSION['user']->username); + exit; + } + + } + + } + + register_error(elgg_echo('pages:delete:failure')); + forward($_SERVER['HTTP_REFERER']); + +?>
\ No newline at end of file diff --git a/mod/pages/actions/pages/edit.php b/mod/pages/actions/pages/edit.php new file mode 100644 index 000000000..84aed61d6 --- /dev/null +++ b/mod/pages/actions/pages/edit.php @@ -0,0 +1,126 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + set_context('pages'); + + //boolean to select correct add to river. It will be new or edit + $which_river = 'new'; + + // Get group fields + $input = array(); + foreach($CONFIG->pages as $shortname => $valuetype) { + $input[$shortname] = get_input($shortname); + if ($valuetype == 'tags') + $input[$shortname] = string_to_tag_array($input[$shortname]); + } + + // Get parent + $parent_guid = (int)get_input('parent_guid', 0); + + // New or old? + $page = NULL; + $pages_guid = (int)get_input('pages_guid'); + if ($pages_guid) + { + $page = get_entity($pages_guid); + if (!$page->canEdit()) + $page = NULL; // if we can't edit it, go no further. + + //select river boolean to edit + $which_river = 'edit'; + } + else + { + $page = new ElggObject(); + if (!$parent_guid) + $page->subtype = 'page_top'; + else + $page->subtype = 'page'; + + // New instance, so set container_guid + $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); + $page->container_guid = $container_guid; + } + + // Have we got it? Can we edit it? + if ($page instanceof ElggObject) + { + // Yes we have, and yes we can. + + // Save fields - note we always save latest description as both description and annotation + if (sizeof($input) > 0) + { + foreach($input as $shortname => $value) { + if ((!$pages_guid) || (($pages_guid) && ($shortname != 'title'))) + $page->$shortname = $value; + } + } + + + // Validate create + if (!$page->title) + { + register_error(elgg_echo("pages:notitle")); + + forward($_SERVER['HTTP_REFERER']); + exit; + } + + // Access ids + $page->access_id = (int)get_input('access_id', ACCESS_PRIVATE); + + // Write access id + $page->write_access_id = (int)get_input('write_access_id', ACCESS_PRIVATE); + + // Set parent + $page->parent_guid = $parent_guid; + + // Ensure ultimate owner + $page->owner_guid = ($page->owner_guid ? $page->owner_guid : $_SESSION['user']->guid); + + // finally save + if ($page->save()) + { + + // Now save description as an annotation + $page->annotate('page', $page->description, $page->access_id); + + + system_message(elgg_echo("pages:saved")); + + //add to river + if($which_river == 'new') + add_to_river('river/object/page/create','create',$_SESSION['user']->guid,$page->guid); + else + add_to_river('river/object/page/update','update',$_SESSION['user']->guid,$page->guid); + + // Forward to the user's profile + forward($page->getUrl()); + exit; + } + else + register_error(elgg_echo('pages:notsaved')); + + } + else + { + register_error(elgg_echo("pages:noaccess")); + } + + + // Forward to the user's profile + forward($page->getUrl()); + exit; +?> diff --git a/mod/pages/actions/pages/editwelcome.php b/mod/pages/actions/pages/editwelcome.php new file mode 100644 index 000000000..85d6e6138 --- /dev/null +++ b/mod/pages/actions/pages/editwelcome.php @@ -0,0 +1,77 @@ +<?php + /** + * Elgg Pages Edit 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-2010 + * @link http://elgg.com/ + */ + + // Load configuration + global $CONFIG; + + gatekeeper(); + + // Get group fields + $message = get_input("pages_welcome"); + $owner_guid = get_input("owner_guid"); + $object_guid = get_input("object_guid"); + $access_id = (int) get_input("access_id"); + + //check to see if this is an edit or new welcome message + if($object_guid){ + + //it is an edit so grab the object + $welcome = get_entity($object_guid); + if ($welcome->getSubtype() == "pages_welcome" && $welcome->canEdit()) { + + $welcome->description = $message; + $welcome->access_id = $access_id; + $welcome->save(); + system_message(elgg_echo("pages:welcomeposted")); + + } else { + + register_error(elgg_echo("pages:welcomeerror")); + + } + + + }else{ + + //it is a new welcome object + if ($owner_guid){ + + $welcome = new ElggObject(); + // Tell the system it's a pages welcome message + $welcome->subtype = "pages_welcome"; + $welcome->title = "Welcome"; + $welcome->description = $message; + $welcome->access_id = $access_id; + + // Set the owner + $welcome->owner_guid = $owner_guid; + + // save + if (!$welcome->save()){ + register_error(elgg_echo("pages:welcomeerror")); + } else { + system_message(elgg_echo("pages:welcomeposted")); + } + + + } else { + + register_error(elgg_echo("pages:welcomeerror")); + + } + + }//end of first if statement + + // Forward to the main blog page + forward("pg/pages/owned/" . get_user($owner_guid)->username); + exit; + +?>
\ No newline at end of file diff --git a/mod/pages/edit.php b/mod/pages/edit.php new file mode 100644 index 000000000..085bb8ee7 --- /dev/null +++ b/mod/pages/edit.php @@ -0,0 +1,42 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + $page_guid = get_input('page_guid'); + $pages = get_entity($page_guid); + + // Get the current page's owner + if ($container = $pages->container_guid) { + set_page_owner($container); + } + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); + } + + $title = elgg_echo("pages:edit"); + $body = elgg_view_title($title); + + if (($pages) && ($pages->canEdit())) + { + $body .= elgg_view("forms/pages/edit", array('entity' => $pages)); + + } else { + $body .= elgg_echo("pages:noaccess"); + } + + $body = elgg_view_layout('two_column_left_sidebar', '', $body); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/pages/history.php b/mod/pages/history.php new file mode 100644 index 000000000..c3bd67154 --- /dev/null +++ b/mod/pages/history.php @@ -0,0 +1,52 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + $page_guid = get_input('page_guid'); + + $pages = get_entity($page_guid); + if ($pages->container_guid) { + set_page_owner($pages->container_guid); + } else { + set_page_owner($pages->owner_guid); + } + + if (is_callable('group_gatekeeper')) group_gatekeeper(); + + $limit = (int)get_input('limit', 20); + $offset = (int)get_input('offset'); + + $page_guid = get_input('page_guid'); + $pages = get_entity($page_guid); + + add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); + + $title = $pages->title . ": " . elgg_echo("pages:history"); + $area2 = elgg_view_title($title); + + $context = get_context(); + + set_context('search'); + + $area2 .= list_annotations($page_guid, 'page', $limit, false); + + set_context($context); + + + pages_set_navigation_parent($pages); + $area3 = elgg_view('pages/sidebar/tree'); + + $body = elgg_view_layout('two_column_left_sidebar', '', $area2, $area3); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/pages/images/application.png b/mod/pages/images/application.png Binary files differnew file mode 100644 index 000000000..1dee9e366 --- /dev/null +++ b/mod/pages/images/application.png diff --git a/mod/pages/images/code.png b/mod/pages/images/code.png Binary files differnew file mode 100644 index 000000000..0c76bd129 --- /dev/null +++ b/mod/pages/images/code.png diff --git a/mod/pages/images/css.png b/mod/pages/images/css.png Binary files differnew file mode 100644 index 000000000..f907e44b3 --- /dev/null +++ b/mod/pages/images/css.png diff --git a/mod/pages/images/db.png b/mod/pages/images/db.png Binary files differnew file mode 100644 index 000000000..bddba1f98 --- /dev/null +++ b/mod/pages/images/db.png diff --git a/mod/pages/images/directory.png b/mod/pages/images/directory.png Binary files differnew file mode 100644 index 000000000..784e8fa48 --- /dev/null +++ b/mod/pages/images/directory.png diff --git a/mod/pages/images/doc.png b/mod/pages/images/doc.png Binary files differnew file mode 100644 index 000000000..ae8ecbf47 --- /dev/null +++ b/mod/pages/images/doc.png diff --git a/mod/pages/images/file.gif b/mod/pages/images/file.gif Binary files differnew file mode 100644 index 000000000..7e6216798 --- /dev/null +++ b/mod/pages/images/file.gif diff --git a/mod/pages/images/file.png b/mod/pages/images/file.png Binary files differnew file mode 100644 index 000000000..8b8b1ca00 --- /dev/null +++ b/mod/pages/images/file.png diff --git a/mod/pages/images/film.png b/mod/pages/images/film.png Binary files differnew file mode 100644 index 000000000..b0ce7bb19 --- /dev/null +++ b/mod/pages/images/film.png diff --git a/mod/pages/images/flash.png b/mod/pages/images/flash.png Binary files differnew file mode 100644 index 000000000..5769120b1 --- /dev/null +++ b/mod/pages/images/flash.png diff --git a/mod/pages/images/folder-closed.gif b/mod/pages/images/folder-closed.gif Binary files differnew file mode 100644 index 000000000..541107888 --- /dev/null +++ b/mod/pages/images/folder-closed.gif diff --git a/mod/pages/images/folder.gif b/mod/pages/images/folder.gif Binary files differnew file mode 100644 index 000000000..2b31631ca --- /dev/null +++ b/mod/pages/images/folder.gif diff --git a/mod/pages/images/folder_open.png b/mod/pages/images/folder_open.png Binary files differnew file mode 100644 index 000000000..4e3548352 --- /dev/null +++ b/mod/pages/images/folder_open.png diff --git a/mod/pages/images/html.png b/mod/pages/images/html.png Binary files differnew file mode 100644 index 000000000..6ed2490ed --- /dev/null +++ b/mod/pages/images/html.png diff --git a/mod/pages/images/java.png b/mod/pages/images/java.png Binary files differnew file mode 100644 index 000000000..b7bfcd15f --- /dev/null +++ b/mod/pages/images/java.png diff --git a/mod/pages/images/linux.png b/mod/pages/images/linux.png Binary files differnew file mode 100644 index 000000000..52699bfee --- /dev/null +++ b/mod/pages/images/linux.png diff --git a/mod/pages/images/minus.gif b/mod/pages/images/minus.gif Binary files differnew file mode 100644 index 000000000..47fb7b767 --- /dev/null +++ b/mod/pages/images/minus.gif diff --git a/mod/pages/images/music.png b/mod/pages/images/music.png Binary files differnew file mode 100644 index 000000000..a8b3ede3d --- /dev/null +++ b/mod/pages/images/music.png diff --git a/mod/pages/images/pages.gif b/mod/pages/images/pages.gif Binary files differnew file mode 100644 index 000000000..2e4ee761a --- /dev/null +++ b/mod/pages/images/pages.gif diff --git a/mod/pages/images/pages_lrg.gif b/mod/pages/images/pages_lrg.gif Binary files differnew file mode 100644 index 000000000..2e41e4739 --- /dev/null +++ b/mod/pages/images/pages_lrg.gif diff --git a/mod/pages/images/pdf.png b/mod/pages/images/pdf.png Binary files differnew file mode 100644 index 000000000..8f8095e46 --- /dev/null +++ b/mod/pages/images/pdf.png diff --git a/mod/pages/images/php.png b/mod/pages/images/php.png Binary files differnew file mode 100644 index 000000000..7868a2594 --- /dev/null +++ b/mod/pages/images/php.png diff --git a/mod/pages/images/picture.png b/mod/pages/images/picture.png Binary files differnew file mode 100644 index 000000000..4a158fef7 --- /dev/null +++ b/mod/pages/images/picture.png diff --git a/mod/pages/images/plus.gif b/mod/pages/images/plus.gif Binary files differnew file mode 100644 index 000000000..690662162 --- /dev/null +++ b/mod/pages/images/plus.gif diff --git a/mod/pages/images/ppt.png b/mod/pages/images/ppt.png Binary files differnew file mode 100644 index 000000000..c4eff0387 --- /dev/null +++ b/mod/pages/images/ppt.png diff --git a/mod/pages/images/psd.png b/mod/pages/images/psd.png Binary files differnew file mode 100644 index 000000000..73c5b3f24 --- /dev/null +++ b/mod/pages/images/psd.png diff --git a/mod/pages/images/ruby.png b/mod/pages/images/ruby.png Binary files differnew file mode 100644 index 000000000..f59b7c436 --- /dev/null +++ b/mod/pages/images/ruby.png diff --git a/mod/pages/images/script.png b/mod/pages/images/script.png Binary files differnew file mode 100644 index 000000000..63fe6ceff --- /dev/null +++ b/mod/pages/images/script.png diff --git a/mod/pages/images/spinner.gif b/mod/pages/images/spinner.gif Binary files differnew file mode 100644 index 000000000..85b99d46b --- /dev/null +++ b/mod/pages/images/spinner.gif diff --git a/mod/pages/images/treeview-black-line.gif b/mod/pages/images/treeview-black-line.gif Binary files differnew file mode 100644 index 000000000..e5496877a --- /dev/null +++ b/mod/pages/images/treeview-black-line.gif diff --git a/mod/pages/images/treeview-black.gif b/mod/pages/images/treeview-black.gif Binary files differnew file mode 100644 index 000000000..d549b9fc5 --- /dev/null +++ b/mod/pages/images/treeview-black.gif diff --git a/mod/pages/images/treeview-default-line.gif b/mod/pages/images/treeview-default-line.gif Binary files differnew file mode 100644 index 000000000..37114d306 --- /dev/null +++ b/mod/pages/images/treeview-default-line.gif diff --git a/mod/pages/images/treeview-default.gif b/mod/pages/images/treeview-default.gif Binary files differnew file mode 100644 index 000000000..a12ac52ff --- /dev/null +++ b/mod/pages/images/treeview-default.gif diff --git a/mod/pages/images/treeview-famfamfam-line.gif b/mod/pages/images/treeview-famfamfam-line.gif Binary files differnew file mode 100644 index 000000000..6e289cecc --- /dev/null +++ b/mod/pages/images/treeview-famfamfam-line.gif diff --git a/mod/pages/images/treeview-famfamfam.gif b/mod/pages/images/treeview-famfamfam.gif Binary files differnew file mode 100644 index 000000000..0cb178e89 --- /dev/null +++ b/mod/pages/images/treeview-famfamfam.gif diff --git a/mod/pages/images/treeview-gray-line.gif b/mod/pages/images/treeview-gray-line.gif Binary files differnew file mode 100644 index 000000000..37600447d --- /dev/null +++ b/mod/pages/images/treeview-gray-line.gif diff --git a/mod/pages/images/treeview-gray.gif b/mod/pages/images/treeview-gray.gif Binary files differnew file mode 100644 index 000000000..cfb8a2f09 --- /dev/null +++ b/mod/pages/images/treeview-gray.gif diff --git a/mod/pages/images/treeview-red-line.gif b/mod/pages/images/treeview-red-line.gif Binary files differnew file mode 100644 index 000000000..df9e749a8 --- /dev/null +++ b/mod/pages/images/treeview-red-line.gif diff --git a/mod/pages/images/treeview-red.gif b/mod/pages/images/treeview-red.gif Binary files differnew file mode 100644 index 000000000..3bbb3a157 --- /dev/null +++ b/mod/pages/images/treeview-red.gif diff --git a/mod/pages/images/txt.png b/mod/pages/images/txt.png Binary files differnew file mode 100644 index 000000000..813f712f7 --- /dev/null +++ b/mod/pages/images/txt.png diff --git a/mod/pages/images/xls.png b/mod/pages/images/xls.png Binary files differnew file mode 100644 index 000000000..b977d7e52 --- /dev/null +++ b/mod/pages/images/xls.png diff --git a/mod/pages/images/zip.png b/mod/pages/images/zip.png Binary files differnew file mode 100644 index 000000000..fd4bbccdf --- /dev/null +++ b/mod/pages/images/zip.png diff --git a/mod/pages/index.php b/mod/pages/index.php new file mode 100644 index 000000000..0e4601cef --- /dev/null +++ b/mod/pages/index.php @@ -0,0 +1,58 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + global $CONFIG; + + // Add menus + $owner = page_owner_entity(); + if (!($owner instanceof ElggGroup)) { + add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); + add_submenu_item(elgg_echo('pages:all'),$CONFIG->wwwroot."mod/pages/world.php", 'pageslinksgeneral'); + } + if (($owner instanceof ElggEntity) && (can_write_to_container(0,$owner->guid))){ + add_submenu_item(elgg_echo('pages:new'), $CONFIG->url . "pg/pages/new/?container_guid=" . page_owner(), 'pagesactions'); + if ($owner instanceof ElggUser) add_submenu_item(elgg_echo('pages:welcome'), $CONFIG->url . "pg/pages/welcome/", 'pagesactions'); + } + + if (is_callable('group_gatekeeper')) group_gatekeeper(); + + $limit = get_input("limit", 10); + $offset = get_input("offset", 0); + + if($owner instanceof ElggGroup){ + $title = sprintf(elgg_echo("pages:group"),$owner->name); + }else{ + $title = sprintf(elgg_echo("pages:user"),$owner->name); + } + + + // Get objects + $context = get_context(); + + set_context('search'); + + $objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => $limit, 'full_view' => FALSE)); + + set_context($context); + + //get the owners latest welcome message + $welcome_message = elgg_get_entities(array('types' => 'object', 'subtypes' => 'pages_welcome', 'owner_guid' => $owner->guid, 'limit' => 1)); + + $body = elgg_view_title($title); + $body .= elgg_view("pages/welcome", array('entity' => $welcome_message)); + $body .= $objects; + $body = elgg_view_layout('two_column_left_sidebar', '', $body); + + // Finally draw the page + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/pages/javascript/jquery.treeview.async.js b/mod/pages/javascript/jquery.treeview.async.js new file mode 100644 index 000000000..e37f98ee9 --- /dev/null +++ b/mod/pages/javascript/jquery.treeview.async.js @@ -0,0 +1,72 @@ +/* + * Async Treeview 0.1 - Lazy-loading extension for Treeview + * + * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ + * + * Copyright (c) 2007 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Revision: $Id$ + * + */ + +;(function($) { + +function load(settings, root, child, container) { + $.getJSON(settings.url, {root: root, currentpage: settings.currentpage}, function(response) { + function createNode(parent) { + var current = $("<li/>").attr("id", this.id || "").html("<span>" + this.text + "</span>").appendTo(parent); + if (this.classes) { + current.children("span").addClass(this.classes); + } + if (this.expanded) { + current.addClass("open"); + } + if (this.hasChildren || this.children && this.children.length) { + var branch = $("<ul/>").appendTo(current); + if (this.hasChildren) { + current.addClass("hasChildren"); + createNode.call({ + text:"placeholder", + id:"placeholder", + children:[] + }, branch); + } + if (this.children && this.children.length) { + $.each(this.children, createNode, [branch]) + } + } + } + $.each(response, createNode, [child]); + $(container).treeview({add: child}, root); + }); +} + +var proxied = $.fn.treeview; +$.fn.treeview = function(settings, source) { + if (!settings.url) { + return proxied.apply(this, arguments); + } + var container = this; + load(settings, source, this, container); + var userToggle = settings.toggle; + return proxied.call(this, $.extend({}, settings, { + collapsed: true, + toggle: function() { + var $this = $(this); + if ($this.hasClass("hasChildren")) { + var childList = $this.removeClass("hasChildren").find("ul"); + childList.empty(); + load(settings, this.id, childList, container); + } + if (userToggle) { + userToggle.apply(this, arguments); + } + } + })); +}; + +})(jQuery);
\ No newline at end of file diff --git a/mod/pages/javascript/jquery.treeview.js b/mod/pages/javascript/jquery.treeview.js new file mode 100644 index 000000000..bc5d9e46b --- /dev/null +++ b/mod/pages/javascript/jquery.treeview.js @@ -0,0 +1,251 @@ +/* + * Treeview 1.4 - jQuery plugin to hide and show branches of a tree + * + * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ + * http://docs.jquery.com/Plugins/Treeview + * + * Copyright (c) 2007 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $ + * + */ + +;(function($) { + + $.extend($.fn, { + swapClass: function(c1, c2) { + var c1Elements = this.filter('.' + c1); + this.filter('.' + c2).removeClass(c2).addClass(c1); + c1Elements.removeClass(c1).addClass(c2); + return this; + }, + replaceClass: function(c1, c2) { + return this.filter('.' + c1).removeClass(c1).addClass(c2).end(); + }, + hoverClass: function(className) { + className = className || "hover"; + return this.hover(function() { + $(this).addClass(className); + }, function() { + $(this).removeClass(className); + }); + }, + heightToggle: function(animated, callback) { + animated ? + this.animate({ height: "toggle" }, animated, callback) : + this.each(function(){ + jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); + if(callback) + callback.apply(this, arguments); + }); + }, + heightHide: function(animated, callback) { + if (animated) { + this.animate({ height: "hide" }, animated, callback); + } else { + this.hide(); + if (callback) + this.each(callback); + } + }, + prepareBranches: function(settings) { + if (!settings.prerendered) { + // mark last tree items + this.filter(":last-child:not(ul)").addClass(CLASSES.last); + // collapse whole tree, or only those marked as closed, anyway except those marked as open + this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide(); + } + // return all items with sublists + return this.filter(":has(>ul)"); + }, + applyClasses: function(settings, toggler) { + this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) { + toggler.apply($(this).next()); + }).add( $("a", this) ).hoverClass(); + + if (!settings.prerendered) { + // handle closed ones first + this.filter(":has(>ul:hidden)") + .addClass(CLASSES.expandable) + .replaceClass(CLASSES.last, CLASSES.lastExpandable); + + // handle open ones + this.not(":has(>ul:hidden)") + .addClass(CLASSES.collapsable) + .replaceClass(CLASSES.last, CLASSES.lastCollapsable); + + // create hitarea + this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() { + var classes = ""; + $.each($(this).parent().attr("class").split(" "), function() { + classes += this + "-hitarea "; + }); + $(this).addClass( classes ); + }); + } + + // apply event to hitarea + this.find("div." + CLASSES.hitarea).click( toggler ); + }, + treeview: function(settings) { + + settings = $.extend({ + cookieId: "treeview" + }, settings); + + if (settings.add) { + return this.trigger("add", [settings.add]); + } + + if ( settings.toggle ) { + var callback = settings.toggle; + settings.toggle = function() { + return callback.apply($(this).parent()[0], arguments); + }; + } + + // factory for treecontroller + function treeController(tree, control) { + // factory for click handlers + function handler(filter) { + return function() { + // reuse toggle event handler, applying the elements to toggle + // start searching for all hitareas + toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() { + // for plain toggle, no filter is provided, otherwise we need to check the parent element + return filter ? $(this).parent("." + filter).length : true; + }) ); + return false; + }; + } + // click on first element to collapse tree + $("a:eq(0)", control).click( handler(CLASSES.collapsable) ); + // click on second to expand tree + $("a:eq(1)", control).click( handler(CLASSES.expandable) ); + // click on third to toggle tree + $("a:eq(2)", control).click( handler() ); + } + + // handle toggle event + function toggler() { + $(this) + .parent() + // swap classes for hitarea + .find(">.hitarea") + .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) + .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) + .end() + // swap classes for parent li + .swapClass( CLASSES.collapsable, CLASSES.expandable ) + .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) + // find child lists + .find( ">ul" ) + // toggle them + .heightToggle( settings.animated, settings.toggle ); + if ( settings.unique ) { + $(this).parent() + .siblings() + // swap classes for hitarea + .find(">.hitarea") + .replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) + .replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) + .end() + .replaceClass( CLASSES.collapsable, CLASSES.expandable ) + .replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) + .find( ">ul" ) + .heightHide( settings.animated, settings.toggle ); + } + } + + function serialize() { + function binary(arg) { + return arg ? 1 : 0; + } + var data = []; + branches.each(function(i, e) { + data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0; + }); + $.cookie(settings.cookieId, data.join("") ); + } + + function deserialize() { + var stored = $.cookie(settings.cookieId); + if ( stored ) { + var data = stored.split(""); + branches.each(function(i, e) { + $(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ](); + }); + } + } + + // add treeview class to activate styles + this.addClass("treeview"); + + // prepare branches and find all tree items with child lists + var branches = this.find("li").prepareBranches(settings); + + switch(settings.persist) { + case "cookie": + var toggleCallback = settings.toggle; + settings.toggle = function() { + serialize(); + if (toggleCallback) { + toggleCallback.apply(this, arguments); + } + }; + deserialize(); + break; + case "location": + var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); }); + if ( current.length ) { + current.addClass("selected").parents("ul, li").add( current.next() ).show(); + } + break; + } + + branches.applyClasses(settings, toggler); + + // if control option is set, create the treecontroller and show it + if ( settings.control ) { + treeController(this, settings.control); + $(settings.control).show(); + } + + return this.bind("add", function(event, branches) { + $(branches).prev() + .removeClass(CLASSES.last) + .removeClass(CLASSES.lastCollapsable) + .removeClass(CLASSES.lastExpandable) + .find(">.hitarea") + .removeClass(CLASSES.lastCollapsableHitarea) + .removeClass(CLASSES.lastExpandableHitarea); + $(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler); + }); + } + }); + + // classes used by the plugin + // need to be styled via external stylesheet, see first example + var CLASSES = $.fn.treeview.classes = { + open: "open", + closed: "closed", + expandable: "expandable", + expandableHitarea: "expandable-hitarea", + lastExpandableHitarea: "lastExpandable-hitarea", + collapsable: "collapsable", + collapsableHitarea: "collapsable-hitarea", + lastCollapsableHitarea: "lastCollapsable-hitarea", + lastCollapsable: "lastCollapsable", + lastExpandable: "lastExpandable", + last: "last", + hitarea: "hitarea" + }; + + // provide backwards compability + $.fn.Treeview = $.fn.treeview; + +})(jQuery);
\ No newline at end of file diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php new file mode 100644 index 000000000..d94ca8431 --- /dev/null +++ b/mod/pages/languages/en.php @@ -0,0 +1,111 @@ +<?php + /** + * Elgg pages plugin language pack + * + * @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-2010 + * @link http://elgg.com/ + */ + + $english = array( + + /** + * Menu items and titles + */ + + 'pages' => "Pages", + 'pages:yours' => "Your pages", + 'pages:user' => "Pages home", + 'pages:group' => "Group pages", + 'pages:all' => "All site pages", + 'pages:new' => "New page", + 'pages:groupprofile' => "Group pages", + 'pages:edit' => "Edit this page", + 'pages:delete' => "Delete this page", + 'pages:history' => "Page history", + 'pages:view' => "View page", + 'pages:welcome' => "Edit welcome message", + 'pages:welcomemessage' => "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.", + 'pages:welcomeerror' => "There was a problem saving your welcome message", + 'pages:welcomeposted' => "Your welcome message has been posted", + 'pages:navigation' => "Page navigation", + 'pages:via' => "via pages", + 'item:object:page_top' => 'Top-level pages', + 'item:object:page' => 'Pages', + 'item:object:pages_welcome' => 'Pages welcome blocks', + 'pages:nogroup' => 'This group does not have any pages yet', + 'pages:more' => 'More pages', + + /** + * River + **/ + + 'pages:river:annotate' => "a comment on this page", + 'pages:river:created' => "%s wrote", + 'pages:river:updated' => "%s updated", + 'pages:river:posted' => "%s posted", + 'pages:river:create' => "a new page titled", + 'pages:river:update' => "a page titled", + 'page:river:annotate' => "a comment on this page", + 'page_top:river:annotate' => "a comment on this page", + + /** + * Form fields + */ + + 'pages:title' => 'Pages Title', + 'pages:description' => 'Your page entry', + 'pages:tags' => 'Tags', + 'pages:access_id' => 'Access', + 'pages:write_access_id' => 'Write access', + + /** + * Status and error messages + */ + 'pages:noaccess' => 'No access to page', + 'pages:cantedit' => 'You can not edit this page', + 'pages:saved' => 'Pages saved', + 'pages:notsaved' => 'Page could not be saved', + 'pages:notitle' => 'You must specify a title for your page.', + 'pages:delete:success' => 'Your page was successfully deleted.', + 'pages:delete:failure' => 'The page could not be deleted.', + + /** + * Page + */ + 'pages:strapline' => 'Last updated %s by %s', + + /** + * History + */ + 'pages:revision' => 'Revision created %s by %s', + + /** + * Widget + **/ + + 'pages:num' => 'Number of pages to display', + 'pages:widget:description' => "This is a list of your pages.", + + /** + * Submenu items + */ + 'pages:label:view' => "View page", + 'pages:label:edit' => "Edit page", + 'pages:label:history' => "Page history", + + /** + * Sidebar items + */ + 'pages:sidebar:this' => "This page", + 'pages:sidebar:children' => "Sub-pages", + 'pages:sidebar:parent' => "Parent", + + 'pages:newchild' => "Create a sub-page", + 'pages:backtoparent' => "Back to '%s'", + ); + + add_translation("en",$english); +?>
\ No newline at end of file diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml new file mode 100644 index 000000000..7e9b2c5e4 --- /dev/null +++ b/mod/pages/manifest.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plugin_manifest> + <field key="author" value="Curverider" /> + <field key="version" value="1.7" /> + <field key="description" value="Elgg Pages" /> + <field key="website" value="http://www.elgg.org" /> + <field key="copyright" value="(C) Curverider 2008-2010" /> + <field key="licence" value="GNU Public License version 2" /> + <field key="elgg_version" value="2010030101" /> +</plugin_manifest> diff --git a/mod/pages/new.php b/mod/pages/new.php new file mode 100644 index 000000000..75ed61732 --- /dev/null +++ b/mod/pages/new.php @@ -0,0 +1,44 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + global $CONFIG; + + // Get the current page's owner + if ($container = (int) get_input('container_guid')) { + set_page_owner($container); + } + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); + } + + //if it is a sub page, provide a link back to parent + if(get_input('parent_guid')){ + $parent = get_entity(get_input('parent_guid')); + + // Breadcrumbs + $area2 .= elgg_view('pages/breadcrumbs', array('page_owner' => $page_owner, 'parent' => $parent, 'add' => true)); + } + + global $CONFIG; + add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); + + $title = elgg_echo("pages:new"); + $area2 .= elgg_view_title($title); + $area2 .= elgg_view("forms/pages/edit"); + + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/pages/pagesTree.php b/mod/pages/pagesTree.php new file mode 100644 index 000000000..b44640d7a --- /dev/null +++ b/mod/pages/pagesTree.php @@ -0,0 +1,14 @@ +<?php + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + if (is_callable('group_gatekeeper')) group_gatekeeper(); + + $page = (int) get_input('root',get_input('source')); + + if (!$page = get_entity($page)) { + exit; + } + + // View tree + echo pages_get_entity_sidebar($page, $fulltree); +?>
\ No newline at end of file diff --git a/mod/pages/start.php b/mod/pages/start.php new file mode 100644 index 000000000..a849807e8 --- /dev/null +++ b/mod/pages/start.php @@ -0,0 +1,345 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + /** + * Initialise the pages plugin. + * + */ + function pages_init() + { + global $CONFIG; + + // Set up the menu for logged in users + if (isloggedin()) + { + add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "pg/pages/owned/" . $_SESSION['user']->username,'pages'); + } + else + { + add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "mod/pages/world.php"); + } + + // Extend hover-over menu + elgg_extend_view('profile/menu/links','pages/menu'); + + // Register a page handler, so we can have nice URLs + register_page_handler('pages','pages_page_handler'); + + // Register a url handler + register_entity_url_handler('pages_url','object', 'page_top'); + register_entity_url_handler('pages_url','object', 'page'); + + // Register some actions + register_action("pages/edit",false, $CONFIG->pluginspath . "pages/actions/pages/edit.php"); + register_action("pages/editwelcome",false, $CONFIG->pluginspath . "pages/actions/pages/editwelcome.php"); + register_action("pages/delete",false, $CONFIG->pluginspath . "pages/actions/pages/delete.php"); + + // Extend some views + elgg_extend_view('css','pages/css'); + elgg_extend_view('groups/menu/links', 'pages/menu'); // Add to groups context + elgg_extend_view('groups/right_column', 'pages/groupprofile_pages'); // Add to groups context + + // Register entity type + register_entity_type('object','page'); + register_entity_type('object','page_top'); + + // Register granular notification for this type + if (is_callable('register_notification_object')) { + register_notification_object('object', 'page', elgg_echo('pages:new')); + register_notification_object('object', 'page_top', elgg_echo('pages:new')); + } + + // Listen to notification events and supply a more useful message + register_plugin_hook('notify:entity:message', 'object', 'page_notify_message'); + + // add the group pages tool option + add_group_tool_option('pages',elgg_echo('groups:enablepages'),true); + + + //add a widget + add_widget_type('pages',elgg_echo('pages'),elgg_echo('pages:widget:description')); + + // For now, we'll hard code the groups profile items as follows: + // TODO make this user configurable + + // Language short codes must be of the form "pages:key" + // where key is the array key below + $CONFIG->pages = array( + 'title' => 'text', + 'description' => 'longtext', + 'tags' => 'tags', + 'access_id' => 'access', + 'write_access_id' => 'access', + ); + } + + function pages_url($entity) { + + global $CONFIG; + + + return $CONFIG->url . "pg/pages/view/{$entity->guid}/"; + + } + + /** + * Sets up submenus for the pages system. Triggered on pagesetup. + * + */ + function pages_submenus() { + + global $CONFIG; + + $page_owner = page_owner_entity(); + + // Group submenu option + if ($page_owner instanceof ElggGroup && get_context() == 'groups') { + if($page_owner->pages_enable != "no"){ + add_submenu_item(sprintf(elgg_echo("pages:group"),$page_owner->name), $CONFIG->wwwroot . "pg/pages/owned/" . $page_owner->username); + } + } + + + } + + /** + * Pages page handler. + * + * @param array $page + */ + function pages_page_handler($page) + { + global $CONFIG; + + if (isset($page[0])) + { + // See what context we're using + switch($page[0]) + { + case "new" : + include($CONFIG->pluginspath . "pages/new.php"); + break; + case "welcome" : + include($CONFIG->pluginspath . "pages/welcome.php"); + break; + case "world": + include($CONFIG->pluginspath . "pages/world.php"); + break; + case "owned" : + // Owned by a user + if (isset($page[1])) + set_input('username',$page[1]); + + include($CONFIG->pluginspath . "pages/index.php"); + break; + case "edit" : + if (isset($page[1])) + set_input('page_guid', $page[1]); + + $entity = get_entity($page[1]); + add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); + // add_submenu_item(elgg_echo('pages:user'), $CONFIG->wwwroot . "pg/pages/owned/" . $_SESSION['user']->username, 'pageslinksgeneral'); + if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); + add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); + + include($CONFIG->pluginspath . "pages/edit.php"); + break; + case "view" : + + if (isset($page[1])) + set_input('page_guid', $page[1]); + + elgg_extend_view('metatags','pages/metatags'); + + $entity = get_entity($page[1]); + //add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); + if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); + add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); + + include($CONFIG->pluginspath . "pages/view.php"); + break; + case "history" : + if (isset($page[1])) + set_input('page_guid', $page[1]); + + elgg_extend_view('metatags','pages/metatags'); + + $entity = get_entity($page[1]); + add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); + if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); + add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); + + include($CONFIG->pluginspath . "pages/history.php"); + break; + default: + include($CONFIG->pluginspath . "pages/new.php"); + break; + } + } + + } + + /** + * Returns a more meaningful message + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + */ + function page_notify_message($hook, $entity_type, $returnvalue, $params) + { + $entity = $params['entity']; + $to_entity = $params['to_entity']; + $method = $params['method']; + if (($entity instanceof ElggEntity) && (($entity->getSubtype() == 'page_top') || ($entity->getSubtype() == 'page'))) + { + $descr = $entity->description; + $title = $entity->title; + global $CONFIG; + $url = $CONFIG->wwwroot . "pg/view/" . $entity->guid; + if ($method == 'sms') { + $owner = $entity->getOwnerEntity(); + return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $url . ' (' . $title . ')'; + } + if ($method == 'email') { + $owner = $entity->getOwnerEntity(); + return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + } + if ($method == 'web') { + $owner = $entity->getOwnerEntity(); + return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + } + } + return null; + } + + + /** + * Sets the parent of the current page, for navigation purposes + * + * @param ElggObject $entity + */ + function pages_set_navigation_parent(ElggObject $entity) { + + $guid = $entity->getGUID(); + + while ($parent_guid = $entity->parent_guid) { + $entity = get_entity($parent_guid); + if ($entity) { + $guid = $entity->getGUID(); + } + } + + set_input('treeguid',$guid); + } + + function pages_get_path($guid) { + + if (!$entity = get_entity($guid)) return array(); + + $path = array($guid); + + while ($parent_guid = $entity->parent_guid) { + $entity = get_entity($parent_guid); + if ($entity) { + $path[] = $entity->getGUID(); + } + } + + return $path; + } + + /** + * Return the correct sidebar for a given entity + * + * @param ElggObject $entity + */ + function pages_get_entity_sidebar(ElggObject $entity, $fulltree = 0) + { + $body = ""; + + $children = elgg_get_entities_from_metadata(array('metadata_names' => 'parent_guid', 'metadata_values' => $entity->guid, 'limit' => 9999)); + $body .= elgg_view('pages/sidebar/sidebarthis', array('entity' => $entity, + 'children' => $children, + 'fulltree' => $fulltree)); + //$body = elgg_view('pages/sidebar/wrapper', array('body' => $body)); + + return $body; + } + + /** + * Extend permissions checking to extend can-edit for write users. + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + */ + function pages_write_permission_check($hook, $entity_type, $returnvalue, $params) + { + if ($params['entity']->getSubtype() == 'page' + || $params['entity']->getSubtype() == 'page_top') { + + $write_permission = $params['entity']->write_access_id; + $user = $params['user']; + + if (($write_permission) && ($user)) + { + // $list = get_write_access_array($user->guid); + $list = get_access_array($user->guid); // get_access_list($user->guid); + + if (($write_permission!=0) && (in_array($write_permission,$list))) + return true; + + } + } + } + + /** + * Extend container permissions checking to extend can_write_to_container for write users. + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + */ + function pages_container_permission_check($hook, $entity_type, $returnvalue, $params) { + + if (get_context() == "pages") { + if (page_owner()) { + if (can_write_to_container($_SESSION['user']->guid, page_owner())) return true; + } + if ($page_guid = get_input('page_guid',0)) { + $entity = get_entity($page_guid); + } else if ($parent_guid = get_input('parent_guid',0)) { + $entity = get_entity($parent_guid); + } + if ($entity instanceof ElggObject) { + if ( + can_write_to_container($_SESSION['user']->guid, $entity->container_guid) + || in_array($entity->write_access_id,get_access_list()) + ) { + return true; + } + } + } + + } + + // write permission plugin hooks + register_plugin_hook('permissions_check', 'object', 'pages_write_permission_check'); + register_plugin_hook('container_permissions_check', 'object', 'pages_container_permission_check'); + + // Make sure the pages initialisation function is called on initialisation + register_elgg_event_handler('init','system','pages_init'); + register_elgg_event_handler('pagesetup','system','pages_submenus'); +?>
\ No newline at end of file diff --git a/mod/pages/view.php b/mod/pages/view.php new file mode 100644 index 000000000..24552b8c3 --- /dev/null +++ b/mod/pages/view.php @@ -0,0 +1,62 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + $page_guid = get_input('page_guid'); + set_context('pages'); + + if (is_callable('group_gatekeeper')) group_gatekeeper(); + + $pages = get_entity($page_guid); + if (!$pages) forward(); + + $container = $pages->container_guid; + + if ($container) { + set_page_owner($container); + } else { + set_page_owner($pages->owner_guid); + } + + global $CONFIG; + // add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); + + if ($pages->canEdit()) { + add_submenu_item(elgg_echo('pages:newchild'),"{$CONFIG->wwwroot}pg/pages/new/?parent_guid={$pages->getGUID()}&container_guid=" . page_owner(), 'pagesactions'); + $delete_url = elgg_add_action_tokens_to_url("{$CONFIG->wwwroot}action/pages/delete?page={$pages->getGUID()}"); + add_submenu_item(elgg_echo('pages:delete'), $delete_url, 'pagesactions', true); + } + + //if the page has a parent, get it + if($parent_page = get_entity(get_input("page_guid"))) + $parent = $parent_page; + + $title = $pages->title; + + // Breadcrumbs + $body = elgg_view('pages/breadcrumbs', array('page_owner' => page_owner_entity(), 'parent' => $parent)); + + $body .= elgg_view_title($pages->title); + $body .= elgg_view_entity($pages, true); + + //add comments + $body .= elgg_view_comments($pages); + + pages_set_navigation_parent($pages); + $sidebar = elgg_view('pages/sidebar/tree'); + + $body = elgg_view_layout('two_column_left_sidebar', '', $body, $sidebar); + + // Finally draw the page + page_draw($title, $body); + +?> diff --git a/mod/pages/views/default/annotation/icon.php b/mod/pages/views/default/annotation/icon.php new file mode 100644 index 000000000..5f943f8ce --- /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-2010 + * @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 $entity->getIcon($vars['size']); ?>" 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..27135b30d --- /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-2010 + * @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..2b57fe814 --- /dev/null +++ b/mod/pages/views/default/forms/pages/edit.php @@ -0,0 +1,92 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + $parent_guid = get_input('parent_guid'); + $container_guid = get_input('container_guid'); + if (!$container_guid) $container_guid = page_owner(); + + $new_page = false; + if (!$vars['entity']) { + $new_page = true; + + // bootstrap the access permissions in the entity array so we can use defaults + if (defined('ACCESS_DEFAULT')) { + $vars['entity']->access_id = ACCESS_DEFAULT; + $vars['entity']->write_access_id = ACCESS_DEFAULT; + } else { + $vars['entity']->access_id = 0; + $vars['entity']->write_access_id = 0; + } + } +?> +<div class="contentWrapper"> +<form action="<?php echo $vars['url']; ?>action/pages/edit" method="post"> +<?php + echo elgg_view('input/securitytoken'); + if (is_array($vars['config']->pages) && sizeof($vars['config']->pages) > 0) + foreach($vars['config']->pages as $shortname => $valtype) { + + $disabled = ""; + + if (!$new_page && ($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 + + } + $cats = elgg_view('categories',$vars); + if (!empty($cats)) { + +?> + <p> + <?php + echo $cats; + ?> + </p> +<?php + + } + +?> + <p> + <?php + if (!$new_page) + { + ?><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 (!$new_page) echo $vars['entity']->parent_guid; else echo $parent_guid; ?>" /> + <input type="hidden" name="owner_guid" value="<?php if (!$new_page) echo $vars['entity']->owner_guid; else echo page_owner(); ?>" /> + <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" /> + </p> + +</form> +</div> 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..996c3a58a --- /dev/null +++ b/mod/pages/views/default/forms/pages/editwelcome.php @@ -0,0 +1,61 @@ +<?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-2010 + * @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 = ACCESS_PRIVATE; + } + + $page_owner = $vars['owner']->guid; + +?> +<div class="contentWrapper"> +<form action="<?php echo $vars['url']; ?>action/pages/editwelcome" method="post"> + + <p class="longtext_editarea"> + <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 + echo elgg_view('input/securitytoken'); + + //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> +</div> diff --git a/mod/pages/views/default/icon/object/page/medium.php b/mod/pages/views/default/icon/object/page/medium.php new file mode 100644 index 000000000..3822ae7a2 --- /dev/null +++ b/mod/pages/views/default/icon/object/page/medium.php @@ -0,0 +1,3 @@ +<?php + echo $vars['url'] . "mod/pages/images/pages_lrg.gif"; +?>
\ No newline at end of file diff --git a/mod/pages/views/default/icon/object/page/small.php b/mod/pages/views/default/icon/object/page/small.php new file mode 100644 index 000000000..81d83523f --- /dev/null +++ b/mod/pages/views/default/icon/object/page/small.php @@ -0,0 +1,3 @@ +<?php + echo $vars['url'] . "mod/pages/images/pages.gif"; +?>
\ No newline at end of file diff --git a/mod/pages/views/default/icon/object/page_top/medium.php b/mod/pages/views/default/icon/object/page_top/medium.php new file mode 100644 index 000000000..3822ae7a2 --- /dev/null +++ b/mod/pages/views/default/icon/object/page_top/medium.php @@ -0,0 +1,3 @@ +<?php + echo $vars['url'] . "mod/pages/images/pages_lrg.gif"; +?>
\ No newline at end of file diff --git a/mod/pages/views/default/icon/object/page_top/small.php b/mod/pages/views/default/icon/object/page_top/small.php new file mode 100644 index 000000000..81d83523f --- /dev/null +++ b/mod/pages/views/default/icon/object/page_top/small.php @@ -0,0 +1,3 @@ +<?php + echo $vars['url'] . "mod/pages/images/pages.gif"; +?>
\ No newline at end of file diff --git a/mod/pages/views/default/object/page.php b/mod/pages/views/default/object/page.php new file mode 100644 index 000000000..09c1852e1 --- /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-2010 + * @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..09c1852e1 --- /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-2010 + * @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..c7e1bfb83 --- /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 = " > <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 " > <a href=\"{$parent->getURL()}\">$parent->title</a></div>"; + }else{ + echo " > $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..c396d45f7 --- /dev/null +++ b/mod/pages/views/default/pages/css.php @@ -0,0 +1,146 @@ +<?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-2010 + * @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; +} + +#pages_page .strapline { + text-align:right; + border-top:1px solid #efefef; + margin:10px 0 10px 0; + color:#666666; +} +#pages_page .categories { + border:none !important; + padding:0 !important; +} + +#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; +} + +.pageswelcome p { + margin:0 0 5px 0; +} + +#sidebar_page_tree { + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + padding:10px; + margin:0 10px 10px 10px; +} +#sidebar_page_tree h3 { + background: none; + border-top: none; + border-bottom: 1px solid #cccccc; + font-size:1.25em; + line-height:1.2em; + margin:0 0 5px 0; + padding:0 0 5px 5px; + color:#0054A7; +} + +/* IE6 */ +* html #pages_welcome_tbl { width:676px !important;} + +.pages_widget_singleitem_more { + margin:0 10px 0 10px; + padding:5px; + display:block; + background:white; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +} + + 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..a1da4bd6b --- /dev/null +++ b/mod/pages/views/default/pages/groupprofile_pages.php @@ -0,0 +1,27 @@ +<?php + + // pages on the group index page + + //check to make sure this group forum has been activated + if($vars['entity']->pages_enable != 'no'){ + +?> + +<div id="group_pages_widget"> +<h2><?php echo elgg_echo("pages:groupprofile"); ?></h2> +<?php + + $objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => 5, 'full_view' => FALSE)); + + if($objects) + echo $objects; + else + echo "<div class=\"forum_latest\">" . elgg_echo("pages:nogroup") . "</div>"; + +?> +<br class="clearfloat" /> +</div> + +<?php + } +?>
\ 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..7b2df4c90 --- /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-2010 + * @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..82b291e2c --- /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..84d95b53b --- /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-2010 + * @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..806f60c9b --- /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-2010 + * @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..b879ca7a2 --- /dev/null +++ b/mod/pages/views/default/pages/pageprofile.php @@ -0,0 +1,83 @@ +<?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-2010 + * @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 class="contentWrapper"> + <div id="pages_page"> + +<?php + if ($entity) + { + echo elgg_view('output/longtext', array('value' => /*$entity->description*/ $latest->value)); + + $tags = $vars['entity']->tags; + if (!empty($tags)) { + +?> + <!-- display tags --> + <p class="tags"> + <?php + + echo elgg_view('output/tags', array('tags' => $tags)); + + ?> + </p> + +<?php + + } + $cats = elgg_view('categories/view',$vars); + if (!empty($cats)) { + +?> + <p class="categories"> + <?php echo $cats; ?> + </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> + +</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..47a262501 --- /dev/null +++ b/mod/pages/views/default/pages/sidebar/sidebarthis.php @@ -0,0 +1,92 @@ +[<?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-2010 + * @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()}\\\">" . 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 new file mode 100644 index 000000000..4734ca929 --- /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..c83e3f682 --- /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..ed21b4dd6 --- /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..deefdba30 --- /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-2010 + * @link http://elgg.com/ + */ + + if($vars['entity']){ + + foreach($vars['entity'] as $welcome){ + + echo "<div class=\"contentWrapper pageswelcome\">" . $welcome->description . "</div>"; + + } + + } else { + +?> + +<div class="contentWrapper pageswelcome"><p><?php elgg_echo('pages:welcomemessage'); ?></p></div> + +<?php + } +?>
\ No newline at end of file diff --git a/mod/pages/views/default/river/object/page/annotate.php b/mod/pages/views/default/river/object/page/annotate.php new file mode 100644 index 000000000..e26671623 --- /dev/null +++ b/mod/pages/views/default/river/object/page/annotate.php @@ -0,0 +1,14 @@ +<?php + + $statement = $vars['statement']; + $performed_by = $statement->getSubject(); + $object = $statement->getObject(); + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $string = sprintf(elgg_echo("pages:river:posted"),$url) . " "; + $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("pages:river:annotate:create") . "</a> " . $object->title; + //$string .= "<div class=\"river_content\">" . $object->title . "</div>"; + +?> + +<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php new file mode 100644 index 000000000..27352cef6 --- /dev/null +++ b/mod/pages/views/default/river/object/page/create.php @@ -0,0 +1,22 @@ +<?php + + $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); + $object = get_entity($vars['item']->object_guid); + $url = $object->getURL(); + + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $contents = strip_tags($object->description); //strip tags from the contents to stop large images etc blowing out the river view + $string = sprintf(elgg_echo("pages:river:created"),$url) . " "; + $string .= elgg_echo("pages:river:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; + $string .= "<div class=\"river_content_display\">"; + if(strlen($contents) > 200) { + $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; + }else{ + $string .= $contents; + } + $string .= "</div>"; + +?> + +<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/pages/views/default/river/object/page/update.php b/mod/pages/views/default/river/object/page/update.php new file mode 100644 index 000000000..ff16e0af8 --- /dev/null +++ b/mod/pages/views/default/river/object/page/update.php @@ -0,0 +1,14 @@ +<?php + + $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); + $object = get_entity($vars['item']->object_guid); + $url = $object->getURL(); + + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $string = sprintf(elgg_echo("pages:river:updated"),$url) . " "; + $string .= elgg_echo("pages:river:update") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; + +?> + +<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/pages/views/default/river/object/page_top/annotate.php b/mod/pages/views/default/river/object/page_top/annotate.php new file mode 100644 index 000000000..fea3e570b --- /dev/null +++ b/mod/pages/views/default/river/object/page_top/annotate.php @@ -0,0 +1,14 @@ +<?php + + $statement = $vars['statement']; + $performed_by = $statement->getSubject(); + $object = $statement->getObject(); + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $string = sprintf(elgg_echo("pages:river:posted"),$url) . " "; + $string .= elgg_echo("pages:river:annotate:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; + //$string .= "<div class=\"river_content\">" . $object->title . "</div>"; + +?> + +<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/pages/views/default/river/object/page_top/create.php b/mod/pages/views/default/river/object/page_top/create.php new file mode 100644 index 000000000..5ff28dfaf --- /dev/null +++ b/mod/pages/views/default/river/object/page_top/create.php @@ -0,0 +1,14 @@ +<?php + + $statement = $vars['statement']; + $performed_by = $statement->getSubject(); + $object = $statement->getObject(); + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $string = sprintf(elgg_echo("pages:river:created"),$url) . " "; + $string .= elgg_echo("pages:river:create") . "<a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; + //$string .= "<div class=\"river_content\">Page title: " . $object->title . "</div>"; + +?> + +<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/pages/views/default/river/object/page_top/update.php b/mod/pages/views/default/river/object/page_top/update.php new file mode 100644 index 000000000..cf4dfbe7d --- /dev/null +++ b/mod/pages/views/default/river/object/page_top/update.php @@ -0,0 +1,14 @@ +<?php + + $statement = $vars['statement']; + $performed_by = $statement->getSubject(); + $object = $statement->getObject(); + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $string = sprintf(elgg_echo("pages:river:updated"),$url) . " "; + $string .= elgg_echo("pages:river:update") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; + //$string .= "<div class=\"river_content\">Title: " . $object->title . "</div>"; + +?> + +<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/pages/views/default/widgets/pages/edit.php b/mod/pages/views/default/widgets/pages/edit.php new file mode 100644 index 000000000..8fb2511f7 --- /dev/null +++ b/mod/pages/views/default/widgets/pages/edit.php @@ -0,0 +1,17 @@ +<?php + + /** + * Elgg pages widget edit + * + * @package ElggPages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +?> + <p> + <?php echo elgg_echo("pages:num"); ?> + <input type="text" name="params[pages_num]" value="<?php echo htmlentities($vars['entity']->pages_num); ?>" /> + </p>
\ No newline at end of file diff --git a/mod/pages/views/default/widgets/pages/view.php b/mod/pages/views/default/widgets/pages/view.php new file mode 100644 index 000000000..2ca32b284 --- /dev/null +++ b/mod/pages/views/default/widgets/pages/view.php @@ -0,0 +1,26 @@ +<style type="text/css"> +#pages_widget .pagination { + display:none; +} +</style> +<?php + + /** + * Elgg pages widget edit + * + * @package ElggPages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + + $num_display = (int) $vars['entity']->pages_num; + + $pages = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => $num_display, 'full_view' => FALSE)); + $pagesurl = $vars['url'] . "pg/pages/owned/" . page_owner_entity()->username; + $pages .= "<div class=\"pages_widget_singleitem_more\"><a href=\"{$pagesurl}\">" . elgg_echo('pages:more') . "</a></div>"; + + echo "<div id=\"pages_widget\">" . $pages . "</div>"; + +?>
\ No newline at end of file diff --git a/mod/pages/welcome.php b/mod/pages/welcome.php new file mode 100644 index 000000000..dfc998f39 --- /dev/null +++ b/mod/pages/welcome.php @@ -0,0 +1,39 @@ +<?php + /** + * Elgg Pages welcome intro + * The user or group owner can set an introduction to their wiki pages + * + * @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-2010 - 2009 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + global $CONFIG; + + // Get the current page's owner + if ($container = (int) get_input('container_guid')) { + set_page_owner($container); + } + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); + } + + //get the owners welcome message if it exists + $welcome_message = elgg_get_entities(array('types' => 'object', 'subtypes' => 'pages_welcome', 'owner_guid' => $page_owner->getGUID(), 'limit' => 1)); + global $CONFIG; + add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); + + $title = elgg_echo("pages:welcome"); + $area2 .= elgg_view_title($title); + $area2 .= elgg_view("forms/pages/editwelcome", array('entity' => $welcome_message, 'owner' => $page_owner)); + + $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2); + + page_draw($title, $body); +?>
\ No newline at end of file diff --git a/mod/pages/world.php b/mod/pages/world.php new file mode 100644 index 000000000..d47212f27 --- /dev/null +++ b/mod/pages/world.php @@ -0,0 +1,54 @@ +<?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-2010 + * @link http://elgg.com/ + */ + + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + global $CONFIG; + + // Get the current page's owner + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + + if (($page_owner instanceof ElggEntity) && ($page_owner->canWriteToContainer())){ + add_submenu_item(elgg_echo('pages:new'), $CONFIG->url . "pg/pages/new/", 'pagesactions'); + add_submenu_item(elgg_echo('pages:welcome'), $CONFIG->url . "pg/pages/welcome/", 'pagesactions'); + } + + if(isloggedin()) + add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); + + add_submenu_item(elgg_echo('pages:all'),$CONFIG->wwwroot."mod/pages/world.php", 'pageslinksgeneral'); + + $limit = get_input("limit", 10); + $offset = get_input("offset", 0); + + $title = sprintf(elgg_echo("pages:all"),page_owner_entity()->name); + + + // Get objects + $context = get_context(); + + set_context('search'); + + $objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'limit' => $limit, 'full_view' => FALSE)); + + set_context($context); + + $body = elgg_view_title($title); + $body .= $objects; + $body = elgg_view_layout('two_column_left_sidebar','',$body); + + // Finally draw the page + page_draw($title, $body); +?>
\ No newline at end of file |