diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-07-15 17:59:57 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-07-15 17:59:57 +0000 |
commit | bcfbbf1b7cf2a0c96af1dfe55c919c09eceac916 (patch) | |
tree | e22653836d685eedbe81df5f4b1c118e6324c86d | |
parent | ff5846ea6cb4e5edc84c99c6eda7b37dccce8bf5 (diff) | |
download | elgg-bcfbbf1b7cf2a0c96af1dfe55c919c09eceac916.tar.gz elgg-bcfbbf1b7cf2a0c96af1dfe55c919c09eceac916.tar.bz2 |
First pass at standardizing pages.
git-svn-id: http://code.elgg.org/elgg/trunk@6716 36083f99-b078-4883-b0ff-0f9b5a30f544
43 files changed, 1569 insertions, 1646 deletions
diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php index 8bda9e794..1ce30472c 100644 --- a/mod/pages/actions/pages/delete.php +++ b/mod/pages/actions/pages/delete.php @@ -1,35 +1,38 @@ <?php +/** + * Remove a page + * + * @package ElggPages + */ - $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; - } +$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; - } + } + 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; } - - } - + forward('pg/pages/owned/' . $_SESSION['user']->username); + exit; + } + } - - register_error(elgg_echo('pages:delete:failure')); - forward($_SERVER['HTTP_REFERER']); -?> +} + +register_error(elgg_echo('pages:delete:failure')); +forward($_SERVER['HTTP_REFERER']); diff --git a/mod/pages/actions/pages/edit.php b/mod/pages/actions/pages/edit.php index ba6d0acdc..c4075a7bb 100644 --- a/mod/pages/actions/pages/edit.php +++ b/mod/pages/actions/pages/edit.php @@ -1,141 +1,137 @@ <?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 ($shortname == 'title') { - $input[$shortname] = strip_tags($input[$shortname]); - } - if ($valuetype == 'tags') - $input[$shortname] = string_to_tag_array($input[$shortname]); +/** + * Edit a page + * + * @package ElggPages + */ + +// 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 ($shortname == 'title') { + $input[$shortname] = strip_tags($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) + 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; + + // cache data in session in case data from form does not validate + $_SESSION['page_description'] = $input['description']; + $_SESSION['page_tags'] = get_input('tags'); + $_SESSION['page_read_access'] = (int)get_input('access_id'); + $_SESSION['page_write_access'] = (int)get_input('write_access_id'); +} + +// 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) { - $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'; + foreach($input as $shortname => $value) { + if ((!$pages_guid) || (($pages_guid) && ($shortname != 'title'))) + $page->$shortname = $value; + } } - else + + + // Validate create + if (!$page->title) { - $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; - - // cache data in session in case data from form does not validate - $_SESSION['page_description'] = $input['description']; - $_SESSION['page_tags'] = get_input('tags'); - $_SESSION['page_read_access'] = (int)get_input('access_id'); - $_SESSION['page_write_access'] = (int)get_input('write_access_id'); + register_error(elgg_echo("pages:notitle")); + + forward($_SERVER['HTTP_REFERER']); + exit; } - - // Have we got it? Can we edit it? - if ($page instanceof ElggObject) + + // 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()) { - // 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); - - // clear cache - unset($_SESSION['page_description']); - unset($_SESSION['page_tags']); - unset($_SESSION['page_read_access']); - unset($_SESSION['page_write_access']); - - - 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; - } + + // Now save description as an annotation + $page->annotate('page', $page->description, $page->access_id); + + // clear cache + unset($_SESSION['page_description']); + unset($_SESSION['page_tags']); + unset($_SESSION['page_read_access']); + unset($_SESSION['page_write_access']); + + + 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 - register_error(elgg_echo('pages:notsaved')); + 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:noaccess")); - } - + register_error(elgg_echo('pages:notsaved')); + +} +else +{ + register_error(elgg_echo("pages:noaccess")); +} + - // Forward to the user's profile - forward($page->getUrl()); - exit; +// 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 index 5d29a5fd9..dd832cb28 100644 --- a/mod/pages/actions/pages/editwelcome.php +++ b/mod/pages/actions/pages/editwelcome.php @@ -1,77 +1,63 @@ <?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/ - */ +/** + * 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(); +// Load configuration +global $CONFIG; - // 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")); - +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 { - - register_error(elgg_echo("pages:welcomeerror")); - + system_message(elgg_echo("pages:welcomeposted")); } - - - }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; - -?> + } else { + register_error(elgg_echo("pages:welcomeerror")); + } +} + +// Forward to the main blog page +forward("pg/pages/owned/" . get_user($owner_guid)->username);
\ No newline at end of file diff --git a/mod/pages/edit.php b/mod/pages/edit.php index 6f42fadbd..e7ce48e54 100644 --- a/mod/pages/edit.php +++ b/mod/pages/edit.php @@ -1,42 +1,36 @@ <?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('one_column_with_sidebar', $body); - - page_draw($title, $body); -?> +/** + * Edit a page form + * + * @package ElggPages + */ +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('one_column_with_sidebar', $body); + +page_draw($title, $body);
\ No newline at end of file diff --git a/mod/pages/history.php b/mod/pages/history.php index fec7702ba..c4e4c85fa 100644 --- a/mod/pages/history.php +++ b/mod/pages/history.php @@ -1,52 +1,47 @@ <?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('one_column_with_sidebar', $area3, $area2); - - page_draw($title, $body); -?> +/** + * Elgg Pages + * + * @package ElggPages + * @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('one_column_with_sidebar', $area3, $area2); + +page_draw($title, $body);
\ No newline at end of file diff --git a/mod/pages/index.php b/mod/pages/index.php index 6c1487c81..93e3428d5 100644 --- a/mod/pages/index.php +++ b/mod/pages/index.php @@ -1,59 +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; - - // 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'); - } - - // access check for closed groups - 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); +/** + * Elgg Pages list + * + * @package ElggPages + */ + +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'); } - - // Get objects - $context = get_context(); - - set_context('search'); - - $objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => $limit, 'offset' => $offset, '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('one_column_with_sidebar', $body); - - // Finally draw the page - page_draw($title, $body); -?> +// access check for closed groups +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, 'offset' => $offset, '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('one_column_with_sidebar', $body); + +// Finally draw the page +page_draw($title, $body); diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php index b31c59572..295c0ef09 100644 --- a/mod/pages/languages/en.php +++ b/mod/pages/languages/en.php @@ -1,111 +1,106 @@ <?php +/** + * Pages languages + * + * @package ElggPages + */ + +$english = array( + /** - * 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/ + * Menu items and titles */ - $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 the pages tool of %s. This tool 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); -?> + '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 the pages tool of %s. This tool 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/new.php b/mod/pages/new.php index b47d91164..7c3f12e36 100644 --- a/mod/pages/new.php +++ b/mod/pages/new.php @@ -1,44 +1,39 @@ <?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(); +/** + * Create a new Page + * + * @package ElggPages + */ + +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; - - // 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('one_column_with_sidebar', $area2, $area1); - - page_draw($title, $body); -?> +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('one_column_with_sidebar', $area2, $area1); + +page_draw($title, $body);
\ No newline at end of file diff --git a/mod/pages/pagesTree.php b/mod/pages/pagesTree.php index 19a8977cb..ed8457a7e 100644 --- a/mod/pages/pagesTree.php +++ b/mod/pages/pagesTree.php @@ -1,14 +1,21 @@ <?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); -?> +/** + * Show the pages tree + * + * @package ElggPages + */ + +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); diff --git a/mod/pages/start.php b/mod/pages/start.php index eee04b4ed..cdd3866ba 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -1,332 +1,334 @@ <?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; - - add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "mod/pages/world.php"); - - // 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')); - } +/** + * Elgg Pages + * + * @package ElggPages + */ - // 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}/"; - +/** + * Initialise the pages plugin. + * + */ +function pages_init() { + global $CONFIG; + + add_menu(elgg_echo('pages'), $CONFIG->wwwroot . "mod/pages/world.php"); + + // 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')); } - - /** - * 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; + + // 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); } } - - } - - /** - * 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 . ')'; +} + +/** + * 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]); } - if ($method == 'email') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + + $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'); } - if ($method == 'web') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + 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]); } - } - return null; + + 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; } + } +} - - /** - * 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(); - } +/** +* 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(); } - - 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 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(); } - - 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; + + set_input('treeguid',$guid); +} + +function pages_get_path($guid) { + + if (!$entity = get_entity($guid)) { + return array(); } - - /** - * 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; - - } + + $path = array($guid); + + while ($parent_guid = $entity->parent_guid) { + $entity = get_entity($parent_guid); + if ($entity) { + $path[] = $entity->getGUID(); } } - - /** - * 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); + + 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; } - 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; - } + } + } +} + +/** + * 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'); -?> + +} + +// 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 index 0000ed48a..2efcf4f04 100644 --- a/mod/pages/view.php +++ b/mod/pages/view.php @@ -1,62 +1,61 @@ <?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/ - */ +/** + * View a single page + * + * @package ElggPages + */ - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - $page_guid = get_input('page_guid'); - set_context('pages'); +$page_guid = get_input('page_guid'); +set_context('pages'); - if (is_callable('group_gatekeeper')) group_gatekeeper(); +if (is_callable('group_gatekeeper')) { + group_gatekeeper(); +} - $pages = get_entity($page_guid); - if (!$pages) forward(); +$pages = get_entity($page_guid); +if (!$pages) { + forward(); +} - $container = $pages->container_guid; +$container = $pages->container_guid; - if ($container) { - set_page_owner($container); - } else { - set_page_owner($pages->owner_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'); +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 ($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; +//if the page has a parent, get it +if ($parent_page = get_entity(get_input("page_guid"))) { + $parent = $parent_page; +} - $title = $pages->title; +$title = $pages->title; - // Breadcrumbs - $body = elgg_view('pages/breadcrumbs', array('page_owner' => page_owner_entity(), 'parent' => $parent)); +// 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); +$body .= elgg_view_title($pages->title); +$body .= elgg_view_entity($pages, true); - //add comments - $body .= elgg_view_comments($pages); +//add comments +$body .= elgg_view_comments($pages); - pages_set_navigation_parent($pages); - $sidebar = elgg_view('pages/sidebar/tree'); +pages_set_navigation_parent($pages); +$sidebar = elgg_view('pages/sidebar/tree'); - $body = elgg_view_layout('one_column_with_sidebar', $body, $sidebar); +$body = elgg_view_layout('one_column_with_sidebar', $body, $sidebar); - // Finally draw the page - page_draw($title, $body); - -?> +// Finally draw the page +page_draw($title, $body);
\ No newline at end of file diff --git a/mod/pages/views/default/annotation/icon.php b/mod/pages/views/default/annotation/icon.php index 3e0195e5f..42d32b021 100644 --- a/mod/pages/views/default/annotation/icon.php +++ b/mod/pages/views/default/annotation/icon.php @@ -1,30 +1,24 @@ <?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/ - */ +/** + * @todo What is this doing here? + * + * @package ElggPages + */ +$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 = ""; +} - $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"> diff --git a/mod/pages/views/default/annotation/page.php b/mod/pages/views/default/annotation/page.php index ecfd0a302..c59c80567 100644 --- a/mod/pages/views/default/annotation/page.php +++ b/mod/pages/views/default/annotation/page.php @@ -1,40 +1,34 @@ <?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( +/** + * Default page listing? + * + * @package ElggPages + */ + +$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 - + ) +); + +$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); -?> +echo elgg_view_listing($icon, $info); diff --git a/mod/pages/views/default/forms/pages/edit.php b/mod/pages/views/default/forms/pages/edit.php index 2ad454073..2095e4fd8 100644 --- a/mod/pages/views/default/forms/pages/edit.php +++ b/mod/pages/views/default/forms/pages/edit.php @@ -1,106 +1,100 @@ <?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/ - */ +/** + * Page edit form. + * + * @package ElggPages + */ - $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; - } +$parent_guid = get_input('parent_guid'); +$container_guid = get_input('container_guid'); +if (!$container_guid) { + $container_guid = page_owner(); +} - // pull in sticky values from session - if (isset($_SESSION['page_description'])) { - $vars['entity']->description = $_SESSION['page_description']; - $vars['entity']->tags = $_SESSION['page_tags']; - $vars['entity']->access_id = $_SESSION['page_read_access']; - $vars['entity']->write_access_id = $_SESSION['page_write_access']; +$new_page = false; +if (!$vars['entity']) { + $new_page = true; - // clear them - unset($_SESSION['page_description']); - unset($_SESSION['page_tags']); - unset($_SESSION['page_read_access']); - unset($_SESSION['page_write_access']); - } + // 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; + } + + // pull in sticky values from session + if (isset($_SESSION['page_description'])) { + $vars['entity']->description = $_SESSION['page_description']; + $vars['entity']->tags = $_SESSION['page_tags']; + $vars['entity']->access_id = $_SESSION['page_read_access']; + $vars['entity']->write_access_id = $_SESSION['page_write_access']; + + // clear them + unset($_SESSION['page_description']); + unset($_SESSION['page_tags']); + unset($_SESSION['page_read_access']); + unset($_SESSION['page_write_access']); } +} ?> <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; - } +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> +<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)) { - + + } +} + +$cats = elgg_view('categories', $vars); +if (!empty($cats)) { ?> - <p> - <?php - echo $cats; - ?> - </p> +<p> + <?php + echo $cats; + ?> +</p> <?php - - } + } + +?> +<p> +<?php +if (!$new_page) { + ?><input type="hidden" name="pages_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /><?php +} + +if ($container_guid) { + ?><input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" /><?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> + <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> +</div>
\ 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 index 39d8d05ca..41721484b 100644 --- a/mod/pages/views/default/forms/pages/editwelcome.php +++ b/mod/pages/views/default/forms/pages/editwelcome.php @@ -1,59 +1,55 @@ <?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; - +/** + * Welcome page edit form + * + * @package ElggPages + */ + +//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; + ?> <form action="<?php echo $vars['url']; ?>action/pages/editwelcome" method="post"> - <p class="longtext_inputarea"> - <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'); + <p class="longtext_inputarea"> + <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 + } + ?> - //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"); ?>" /> +<input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" /> </form> diff --git a/mod/pages/views/default/icon/object/page/medium.php b/mod/pages/views/default/icon/object/page/medium.php index 1e5c1538e..bb81a9653 100644 --- a/mod/pages/views/default/icon/object/page/medium.php +++ b/mod/pages/views/default/icon/object/page/medium.php @@ -1,3 +1,8 @@ <?php - echo $vars['url'] . "mod/pages/images/pages_lrg.gif"; -?> +/** + * Page icon override medium + * + * @package ElggPages + */ + +echo $vars['url'] . "mod/pages/images/pages_lrg.gif"; diff --git a/mod/pages/views/default/icon/object/page/small.php b/mod/pages/views/default/icon/object/page/small.php index 3ccc859f3..55466f539 100644 --- a/mod/pages/views/default/icon/object/page/small.php +++ b/mod/pages/views/default/icon/object/page/small.php @@ -1,3 +1,8 @@ <?php - echo $vars['url'] . "mod/pages/images/pages.gif"; -?> +/** + * Page icon override small + * + * @package ElggPages + */ + +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 index 1e5c1538e..bb5c367b2 100644 --- a/mod/pages/views/default/icon/object/page_top/medium.php +++ b/mod/pages/views/default/icon/object/page_top/medium.php @@ -1,3 +1,9 @@ <?php - echo $vars['url'] . "mod/pages/images/pages_lrg.gif"; +/** + * Top page icon override medium + * + * @package ElggPages + */ + +echo $vars['url'] . "mod/pages/images/pages_lrg.gif"; ?> diff --git a/mod/pages/views/default/icon/object/page_top/small.php b/mod/pages/views/default/icon/object/page_top/small.php index 3ccc859f3..5be6e578d 100644 --- a/mod/pages/views/default/icon/object/page_top/small.php +++ b/mod/pages/views/default/icon/object/page_top/small.php @@ -1,3 +1,8 @@ <?php - echo $vars['url'] . "mod/pages/images/pages.gif"; -?> +/** + * Top Page icon override small + * + * @package ElggPages + */ + +echo $vars['url'] . "mod/pages/images/pages.gif"; diff --git a/mod/pages/views/default/object/page.php b/mod/pages/views/default/object/page.php index 843209609..5b4af5198 100644 --- a/mod/pages/views/default/object/page.php +++ b/mod/pages/views/default/object/page.php @@ -1,21 +1,16 @@ <?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/ - */ +/** + * Page view + * + * @package ElggPages + */ - if ($vars['full']) { - echo elgg_view("pages/pageprofile",$vars); +if ($vars['full']) { + echo elgg_view("pages/pageprofile", $vars); +} else { + if (get_input('search_viewtype') == "gallery") { + echo elgg_view('pages/pagegallery', $vars); } else { - if (get_input('search_viewtype') == "gallery") { - echo elgg_view('pages/pagegallery',$vars); - } else { - echo elgg_view("pages/pagelisting",$vars); - } + 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 index 843209609..6922118c1 100644 --- a/mod/pages/views/default/object/page_top.php +++ b/mod/pages/views/default/object/page_top.php @@ -1,21 +1,16 @@ <?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/ - */ +/** + * View for page object + * + * @package ElggPages + */ - if ($vars['full']) { - echo elgg_view("pages/pageprofile",$vars); +if ($vars['full']) { + echo elgg_view("pages/pageprofile", $vars); +} else { + if (get_input('search_viewtype') == "gallery") { + echo elgg_view('pages/pagegallery', $vars); } else { - if (get_input('search_viewtype') == "gallery") { - echo elgg_view('pages/pagegallery',$vars); - } else { - echo elgg_view("pages/pagelisting",$vars); - } + 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 index a6626ca39..868a3eeb5 100644 --- a/mod/pages/views/default/pages/breadcrumbs.php +++ b/mod/pages/views/default/pages/breadcrumbs.php @@ -1,28 +1,30 @@ <?php +/** + * Breadcrumbs for pages. + * + * @package ElggPages + */ - $page_owner = $vars['page_owner']; - $parent = $vars['parent']; +$page_owner = $vars['page_owner']; +$parent = $vars['parent']; - $breadcrumbs = ''; - - $owner_url = $CONFIG->wwwroot . "pg/pages/owned/" . get_entity($page_owner)->username; - echo "<div id='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>"; - } +$breadcrumbs = ''; -?> +$owner_url = $CONFIG->wwwroot . "pg/pages/owned/" . get_entity($page_owner)->username; +echo "<div id='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 index c396d45f7..78298c6a1 100644 --- a/mod/pages/views/default/pages/css.php +++ b/mod/pages/views/default/pages/css.php @@ -1,15 +1,12 @@ <?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/ - */ +/** + * Elgg Pages CSS + * + * @package ElggPages + */ ?> -.treeview, .treeview ul { +.treeview, .treeview ul { padding: 0; margin: 0; list-style: none; @@ -34,7 +31,7 @@ float:none; } -.treeview li { +.treeview li { margin: 0; padding: 3px 0pt 3px 16px; } @@ -53,23 +50,23 @@ .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, .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-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-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-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); } +.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; } @@ -84,19 +81,19 @@ } #pages_page .strapline { - text-align:right; - border-top:1px solid #efefef; - margin:10px 0 10px 0; - color:#666666; + text-align:right; + border-top:1px solid #efefef; + margin:10px 0 10px 0; + color:#666666; } #pages_page .categories { - border:none !important; - padding:0 !important; + border:none !important; + padding:0 !important; } #pages_page .tags { - padding:0 0 0 16px; - margin:10px 0 4px 0; + 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; } @@ -115,10 +112,10 @@ #sidebar_page_tree { background:white; - -webkit-border-radius: 8px; + -webkit-border-radius: 8px; -moz-border-radius: 8px; - padding:10px; - margin:0 10px 10px 10px; + padding:10px; + margin:0 10px 10px 10px; } #sidebar_page_tree h3 { background: none; @@ -139,8 +136,6 @@ padding:5px; display:block; background:white; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; -} - - + -webkit-border-radius: 8px; + -moz-border-radius: 8px; +}
\ No newline at end of file diff --git a/mod/pages/views/default/pages/groupprofile_pages.php b/mod/pages/views/default/pages/groupprofile_pages.php index 006a05877..17c1d87ed 100644 --- a/mod/pages/views/default/pages/groupprofile_pages.php +++ b/mod/pages/views/default/pages/groupprofile_pages.php @@ -1,27 +1,28 @@ <?php - - // pages on the group index page - - //check to make sure this group forum has been activated - if($vars['entity']->pages_enable != 'no'){ +/** + * Page icon override medium + * + * @package ElggPages + */ +//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) + $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 - } -?> + } diff --git a/mod/pages/views/default/pages/metatags.php b/mod/pages/views/default/pages/metatags.php index 82b291e2c..b803a32a5 100644 --- a/mod/pages/views/default/pages/metatags.php +++ b/mod/pages/views/default/pages/metatags.php @@ -1,22 +1,27 @@ <?php +/** + * Metatag extended view. + * + * @package ElggPages + */ - $treeguid = get_input('treeguid'); - if (empty($treeguid)) { - $treeguid = get_input('page_guid'); - } +$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> +<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 index 1ff32016d..0dadb63c2 100644 --- a/mod/pages/views/default/pages/pagegallery.php +++ b/mod/pages/views/default/pages/pagegallery.php @@ -1,37 +1,31 @@ <?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/ - */ +/** + * Elgg Pages gallery listing. + * + * @package ElggPages + */ - $icon = elgg_view( - "graphics/icon", array( - 'entity' => $vars['entity'], - 'size' => 'medium', - ) - ); +$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>"; +$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>"; - } +$latest = $vars['entity']->getAnnotations('page', 1, 0, 'desc'); +if ($latest) { + $latest = $latest[0]; - echo elgg_view_listing($icon, $info); -?> + $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 index 4da9fd4a2..4dc5dc3b3 100644 --- a/mod/pages/views/default/pages/pagelisting.php +++ b/mod/pages/views/default/pages/pagelisting.php @@ -1,38 +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/ - */ +/** + * Elgg Pages flat listing + * + * @package ElggPages + */ - $icon = elgg_view( - "graphics/icon", array( - 'entity' => $vars['entity'], - 'size' => 'small', - ) - ); +$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>"; +$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); -?> +$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); diff --git a/mod/pages/views/default/pages/pageprofile.php b/mod/pages/views/default/pages/pageprofile.php index b1081d9f7..cc3113b4e 100644 --- a/mod/pages/views/default/pages/pageprofile.php +++ b/mod/pages/views/default/pages/pageprofile.php @@ -1,83 +1,74 @@ <?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"> +/** + * Elgg Pages profile + * + * @package ElggPages + */ + +// 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) - { + + <?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 + + <?php } $cats = elgg_view('categories/view',$vars); if (!empty($cats)) { - -?> + + ?> <p class="categories"> <?php echo $cats; ?> </p> -<?php - + <?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> </div> diff --git a/mod/pages/views/default/pages/sidebar/sidebarthis.php b/mod/pages/views/default/pages/sidebar/sidebarthis.php index 1c8b77848..173ddb91a 100644 --- a/mod/pages/views/default/pages/sidebar/sidebarthis.php +++ b/mod/pages/views/default/pages/sidebar/sidebarthis.php @@ -1,92 +1,88 @@ [<?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; - } +/** + * Side bar page tree. + * + * @package ElggPages + */ + +global $CONFIG; +$entity = $vars['entity']; +$parent = $vars['entity']->parent_guid; + +$currentpage = (int) get_input('currentpage'); +if ($currentpage) { + + $path = pages_get_path($currentpage); + $pathstring = implode(',',$path); + +} else { + $path = array(); +} + +function pages_draw_child($childentity, $path) { + + $child = "\n\t\t{\n"; + $child .= "\t\t\t\"text\": \"<a href=\\\"{$childentity->getURL()}\\\">" . addslashes($childentity->title) . "</a>\"\n"; + + $extras = ""; + $haschild = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $childentity->guid, 'limit' => 9999)); + if ($haschild) { + if (in_array($childentity->guid,$path)) { + $extras .= "\t\t\t,\"expanded\": true"; + $extras .= "\t\t\t,\"children\": [\n"; + + $childstring = ""; + foreach($haschild as $subchild) { + $childstringtemp = pages_draw_child($subchild,$path); + if (!empty($childstringtemp)) { + if (!empty($childstring)) $childstring .= ", "; + $childstring .= $childstringtemp; } - - $extras .= $childstring . "\n\t\t\t]\n"; - } else { - $extras .= ",\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\n"; } - - } - $child .= $extras . "\t\t}"; - return $child; - } - - if (!$parent) { - echo "{\n"; - echo "\t\"text\": \"<a href=\\\"{$vars['entity']->getURL()}\\\">" . addslashes($vars['entity']->title) . "</a>\"\n"; - } - - $children = ""; - $temp = ""; - if (isset($vars['children']) && is_array($vars['children']) && (!isset($vars['fulltree']) || $vars['fulltree'] == 0)) { - if (!$parent) $temp .= "\t" . '"expanded": true,' . "\n"; - if (!$parent) $temp .= "\t" . '"children": [' . "\n"; - foreach($vars['children'] as $child) { - $childrentemp = pages_draw_child($child,$path); - if (!empty($childrentemp)) { - if (!empty($children)) $children .= ", \n"; - $children .= $childrentemp; + + $extras .= $childstring . "\n\t\t\t]\n"; + } else { + $extras .= ",\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\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}"; - */ + + } + $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; } - if (!empty($temp)) echo ',' . $temp; - echo $children; - if (!$parent) echo "\t\t" . ']' . "\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}"; + */ } - - if (!$parent) echo "}"; + 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 index edc66e499..f533356b3 100644 --- a/mod/pages/views/default/pages/sidebar/starter.php +++ b/mod/pages/views/default/pages/sidebar/starter.php @@ -1,21 +1,19 @@ <?php +/** + * Start Pages page output + * + * @package ElggPages + */ - if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) { +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 index 07de1beb5..399caf108 100644 --- a/mod/pages/views/default/pages/sidebar/tree.php +++ b/mod/pages/views/default/pages/sidebar/tree.php @@ -1,8 +1,12 @@ <?php - +/** + * Side bar tree wrapper. + * + * @package ElggPages + */ ?> <div id="sidebar_page_tree"> - <h3><?php echo elgg_echo("pages:navigation"); ?></h3> + <h3><?php echo elgg_echo("pages:navigation"); ?></h3> <div id="pagesTree" class="pagesTreeContainer"></div> </div> <br class="clearfloat" /> diff --git a/mod/pages/views/default/pages/sidebar/wrapper.php b/mod/pages/views/default/pages/sidebar/wrapper.php index 2109188cf..93b746eb0 100644 --- a/mod/pages/views/default/pages/sidebar/wrapper.php +++ b/mod/pages/views/default/pages/sidebar/wrapper.php @@ -1,7 +1,10 @@ <?php +/** + * Pages page wrapper + * + * @package ElggPages + */ - echo "["; - echo $vars['body']; - echo "]"; - -?> +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 index a390a9d65..7802fa5af 100644 --- a/mod/pages/views/default/pages/welcome.php +++ b/mod/pages/views/default/pages/welcome.php @@ -1,29 +1,16 @@ <?php +/** + * Elgg Pages welcome message + * + * @package ElggPages + */ - /** - * 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 { - +if($vars['entity']) { + foreach($vars['entity'] as $welcome){ + echo "<div class=\"contentWrapper pageswelcome\">" . $welcome->description . "</div>"; + } +} else { ?> - <div class="contentWrapper pageswelcome"><p><?php echo sprintf(elgg_echo('pages:welcomemessage'), $vars['config']->sitename); ?></p></div> - <?php - } -?> +} diff --git a/mod/pages/views/default/river/object/page/annotate.php b/mod/pages/views/default/river/object/page/annotate.php index 4bee26d81..4f913dbaa 100644 --- a/mod/pages/views/default/river/object/page/annotate.php +++ b/mod/pages/views/default/river/object/page/annotate.php @@ -1,14 +1,17 @@ <?php +/** + * Page annotate river entry + * + * @package ElggPages + */ - $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>"; +$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; ?> +echo $string; diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php index 00885d154..dc4554404 100644 --- a/mod/pages/views/default/river/object/page/create.php +++ b/mod/pages/views/default/river/object/page/create.php @@ -1,17 +1,22 @@ <?php +/** + * Page create river view + * + * @package ElggPages + */ - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $url = $object->getURL(); +$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> <span class='entity_subtext'>". friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link'>Comment</a>"; - $string .= elgg_view('likes/forms/link', array('entity' => $object)); - $string .= "<div class=\"river_content_display\">"; - $string .= elgg_make_excerpt($contents, 200); - $string .= "</div>"; - echo $string; +$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> <span class='entity_subtext'>". friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link'>Comment</a>"; +$string .= elgg_view('likes/forms/link', array('entity' => $object)); +$string .= "<div class=\"river_content_display\">"; +$string .= elgg_make_excerpt($contents, 200); +$string .= "</div>"; + +echo $string; diff --git a/mod/pages/views/default/river/object/page/update.php b/mod/pages/views/default/river/object/page/update.php index 2b20a9ed8..82b38f315 100644 --- a/mod/pages/views/default/river/object/page/update.php +++ b/mod/pages/views/default/river/object/page/update.php @@ -1,14 +1,16 @@ <?php +/** + * Page update river view + * + * @package ElggPages + */ - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $url = $object->getURL(); +$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>"; - -?> +$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; ?> +echo $string; diff --git a/mod/pages/views/default/river/object/page_top/annotate.php b/mod/pages/views/default/river/object/page_top/annotate.php index f3a47e5d9..43270f736 100644 --- a/mod/pages/views/default/river/object/page_top/annotate.php +++ b/mod/pages/views/default/river/object/page_top/annotate.php @@ -1,14 +1,16 @@ <?php +/** + * Top page annotation river view. + * + * @package ElggPages + */ - $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>"; +$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>"; -<?php echo $string; ?> +echo $string; diff --git a/mod/pages/views/default/river/object/page_top/create.php b/mod/pages/views/default/river/object/page_top/create.php index 9427d5caa..d49f3d5c4 100644 --- a/mod/pages/views/default/river/object/page_top/create.php +++ b/mod/pages/views/default/river/object/page_top/create.php @@ -1,14 +1,15 @@ <?php +/** + * Top page create river view. + * + * @package ElggPages + */ - $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>"; +$statement = $vars['statement']; +$performed_by = $statement->getSubject(); +$object = $statement->getObject(); -?> - -<?php echo $string; ?> +$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>"; +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 index febe2965d..6187f54bc 100644 --- a/mod/pages/views/default/river/object/page_top/update.php +++ b/mod/pages/views/default/river/object/page_top/update.php @@ -1,14 +1,16 @@ <?php +/** + * Top page update river view + * + * @package ElggPages + */ - $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>"; - -?> +$statement = $vars['statement']; +$performed_by = $statement->getSubject(); +$object = $statement->getObject(); -<?php echo $string; ?> +$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>"; + +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 index 6459a0373..4ddfec428 100644 --- a/mod/pages/views/default/widgets/pages/edit.php +++ b/mod/pages/views/default/widgets/pages/edit.php @@ -1,14 +1,9 @@ <?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/ - */ +/** + * Elgg pages widget edit + * + * @package ElggPages + */ if (!isset($vars['entity']->pages_num)) { $vars['entity']->pages_num = 4; @@ -16,10 +11,10 @@ if (!isset($vars['entity']->pages_num)) { ?> <p> - <?php echo elgg_echo("pages:num"); ?>: - <select name="params[pages_num]"> -<?php +<?php echo elgg_echo("pages:num"); ?>: +<select name="params[pages_num]"> +<?php for ($i=1; $i<=10; $i++) { $selected = ''; if ($vars['entity']->pages_num == $i) { @@ -29,5 +24,5 @@ for ($i=1; $i<=10; $i++) { echo " <option value='{$i}' $selected >{$i}</option>\n"; } ?> - </select> +</select> </p> diff --git a/mod/pages/views/default/widgets/pages/view.php b/mod/pages/views/default/widgets/pages/view.php index d975dcdc0..5428b89a1 100644 --- a/mod/pages/views/default/widgets/pages/view.php +++ b/mod/pages/views/default/widgets/pages/view.php @@ -1,32 +1,28 @@ <style type="text/css"> #pages_widget .pagination { - display:none; + 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; - if (!$num_display) { - $num_display = 4; - } - - $pages = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => $num_display, 'full_view' => FALSE)); - - if ($pages) { - $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>"; - } +/** + * Elgg pages widget edit + * + * @package ElggPages + * @link http://elgg.com/ + */ - echo "<div id=\"pages_widget\">" . $pages . "</div>"; - -?> +$num_display = (int) $vars['entity']->pages_num; + +if (!$num_display) { + $num_display = 4; +} + +$pages = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => $num_display, 'full_view' => FALSE)); + +if ($pages) { + $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 index 3ff0c3aae..54a9e7b53 100644 --- a/mod/pages/welcome.php +++ b/mod/pages/welcome.php @@ -1,39 +1,35 @@ <?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/ - */ +/** + * Elgg Pages welcome intro + * The user or group owner can set an introduction to their wiki pages + * + * @package ElggPages + */ - 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('one_column_with_sidebar', $area2, $area1); - - page_draw($title, $body); -?> +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('one_column_with_sidebar', $area2, $area1); + +page_draw($title, $body);
\ No newline at end of file diff --git a/mod/pages/world.php b/mod/pages/world.php index 65f054dfb..5a406b32b 100644 --- a/mod/pages/world.php +++ b/mod/pages/world.php @@ -1,54 +1,49 @@ <?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, 'offset' => $offset, 'full_view' => FALSE)); - - set_context($context); - - $body = elgg_view_title($title); - $body .= $objects; - $body = elgg_view_layout('one_column_with_sidebar', $body); - - // Finally draw the page - page_draw($title, $body); -?> +/** + * Elgg Pages + * + * @package ElggPages + */ + +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, 'offset' => $offset, 'full_view' => FALSE)); + +set_context($context); + +$body = elgg_view_title($title); +$body .= $objects; +$body = elgg_view_layout('one_column_with_sidebar', $body); + +// Finally draw the page +page_draw($title, $body);
\ No newline at end of file |