diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/pages/actions/pages/editwelcome.php | 84 | ||||
-rw-r--r-- | mod/pages/history.php | 2 | ||||
-rw-r--r-- | mod/pages/index.php | 14 | ||||
-rw-r--r-- | mod/pages/languages/en.php | 18 | ||||
-rw-r--r-- | mod/pages/new.php | 16 | ||||
-rw-r--r-- | mod/pages/start.php | 660 | ||||
-rw-r--r-- | mod/pages/views/default/forms/pages/editwelcome.php | 32 | ||||
-rw-r--r-- | mod/pages/views/default/pages/breadcrumbs.php | 40 | ||||
-rw-r--r-- | mod/pages/views/default/pages/css.php | 20 | ||||
-rw-r--r-- | mod/pages/views/default/pages/groupprofile_pages.php | 12 | ||||
-rw-r--r-- | mod/pages/views/default/pages/pageprofile.php | 2 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/tree.php | 2 | ||||
-rw-r--r-- | mod/pages/views/default/pages/welcome.php | 20 | ||||
-rw-r--r-- | mod/pages/views/default/river/object/page/update.php | 2 | ||||
-rw-r--r-- | mod/pages/views/default/river/object/page_top/update.php | 4 | ||||
-rw-r--r-- | mod/pages/views/default/widgets/pages/edit.php | 2 | ||||
-rw-r--r-- | mod/pages/views/default/widgets/pages/view.php | 16 | ||||
-rw-r--r-- | mod/pages/welcome.php | 4 | ||||
-rw-r--r-- | mod/pages/world.php | 20 |
19 files changed, 485 insertions, 485 deletions
diff --git a/mod/pages/actions/pages/editwelcome.php b/mod/pages/actions/pages/editwelcome.php index 30d8bc1b8..5d29a5fd9 100644 --- a/mod/pages/actions/pages/editwelcome.php +++ b/mod/pages/actions/pages/editwelcome.php @@ -22,54 +22,54 @@ //check to see if this is an edit or new welcome message if($object_guid){ -t -t //it is an edit so grab the object -t $welcome = get_entity($object_guid); + + //it is an edit so grab the object + $welcome = get_entity($object_guid); if ($welcome->getSubtype() == "pages_welcome" && $welcome->canEdit()) { -t -t $welcome->description = $message; -t $welcome->access_id = $access_id; -t $welcome->save(); -t system_message(elgg_echo("pages:welcomeposted")); -t + + $welcome->description = $message; + $welcome->access_id = $access_id; + $welcome->save(); + system_message(elgg_echo("pages:welcomeposted")); + } else { -t -t register_error(elgg_echo("pages:welcomeerror")); -t + + register_error(elgg_echo("pages:welcomeerror")); + } -t -t + + }else{ -tt//it is a new welcome object -t if ($owner_guid){ -tt -t $welcome = new ElggObject(); -t // Tell the system it's a pages welcome message -t $welcome->subtype = "pages_welcome"; -t $welcome->title = "Welcome"; -t $welcome->description = $message; -t $welcome->access_id = $access_id; -t -t // Set the owner -t $welcome->owner_guid = $owner_guid; -t -t t// save -t if (!$welcome->save()){ -t register_error(elgg_echo("pages:welcomeerror")); -t } else { -tt system_message(elgg_echo("pages:welcomeposted")); -t } -t -t -t } else { -tt -tt register_error(elgg_echo("pages:welcomeerror")); -tt -t } -t + //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 -t + // Forward to the main blog page forward("pg/pages/owned/" . get_user($owner_guid)->username); exit; diff --git a/mod/pages/history.php b/mod/pages/history.php index 215d5ea58..fec7702ba 100644 --- a/mod/pages/history.php +++ b/mod/pages/history.php @@ -14,7 +14,7 @@ $page_guid = get_input('page_guid'); -t$pages = get_entity($page_guid); + $pages = get_entity($page_guid); if ($pages->container_guid) { set_page_owner($pages->container_guid); } else { diff --git a/mod/pages/index.php b/mod/pages/index.php index 02d13a3a7..6c1487c81 100644 --- a/mod/pages/index.php +++ b/mod/pages/index.php @@ -16,14 +16,14 @@ // Add menus $owner = page_owner_entity(); if (!($owner instanceof ElggGroup)) { -t add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); -t add_submenu_item(elgg_echo('pages:all'),$CONFIG->wwwroot."mod/pages/world.php", 'pageslinksgeneral'); + 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'); } -tif (($owner instanceof ElggEntity) && (can_write_to_container(0,$owner->guid))){ -ttadd_submenu_item(elgg_echo('pages:new'), $CONFIG->url . "pg/pages/new/?container_guid=" . page_owner(), 'pagesactions'); -ttif ($owner instanceof ElggUser) add_submenu_item(elgg_echo('pages:welcome'), $CONFIG->url . "pg/pages/welcome/", 'pagesactions'); -t} -t + 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(); diff --git a/mod/pages/languages/en.php b/mod/pages/languages/en.php index 2eb2469d8..b31c59572 100644 --- a/mod/pages/languages/en.php +++ b/mod/pages/languages/en.php @@ -31,7 +31,7 @@ 'pages:welcomeerror' => "There was a problem saving your welcome message", 'pages:welcomeposted' => "Your welcome message has been posted", 'pages:navigation' => "Page navigation", - tt'pages:via' => "via pages", + 'pages:via' => "via pages", 'item:object:page_top' => 'Top-level pages', 'item:object:page' => 'Pages', 'item:object:pages_welcome' => 'Pages welcome blocks', @@ -42,14 +42,14 @@ * River **/ - t'pages:river:annotate' => "a comment on this page", - t'pages:river:created' => "%s wrote", - tt'pages:river:updated' => "%s updated", - tt'pages:river:posted' => "%s posted", + '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", - tt'pages:river:update' => "a page titled", - tt'page:river:annotate' => "a comment on this page", - tt'page_top:river:annotate' => "a comment on this page", + '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 @@ -86,7 +86,7 @@ * Widget **/ - t'pages:num' => 'Number of pages to display', + 'pages:num' => 'Number of pages to display', 'pages:widget:description' => "This is a list of your pages.", /** diff --git a/mod/pages/new.php b/mod/pages/new.php index 7cf46d1c3..b47d91164 100644 --- a/mod/pages/new.php +++ b/mod/pages/new.php @@ -25,15 +25,15 @@ //if it is a sub page, provide a link back to parent if(get_input('parent_guid')){ - t$parent = get_entity(get_input('parent_guid')); - t - t// Breadcrumbs - t$area2 .= elgg_view('pages/breadcrumbs', array('page_owner' => $page_owner, 'parent' => $parent, 'add' => true)); -t} -t -tglobal $CONFIG; + $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'); -t + $title = elgg_echo("pages:new"); $area2 .= elgg_view_title($title); $area2 .= elgg_view("forms/pages/edit"); diff --git a/mod/pages/start.php b/mod/pages/start.php index 308a241f5..080ec0bf8 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -1,332 +1,332 @@ <?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')); - } - - // 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 optiont -tttadd_group_tool_option('pages',elgg_echo('groups:enablepages'),true); - - - //add a widget - tadd_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') { -t if($page_owner->pages_enable != "no"){ - tadd_submenu_item(sprintf(elgg_echo("pages:group"),$page_owner->name), $CONFIG->wwwroot . "pg/pages/owned/" . $page_owner->username); - t} - } -t} - - /** - * 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"); -tt break; -tt case "welcome" : - include($CONFIG->pluginspath . "pages/welcome.php"); -tt break; -t case "world": - include($CONFIG->pluginspath . "pages/world.php"); -tt break; -t case "owned" : -t // Owned by a user -t if (isset($page[1])) -t set_input('username',$page[1]); -t -t include($CONFIG->pluginspath . "pages/index.php"); -t break; -t case "edit" : -t if (isset($page[1])) -t set_input('page_guid', $page[1]); -t -t $entity = get_entity($page[1]); -t add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); -t // add_submenu_item(elgg_echo('pages:user'), $CONFIG->wwwroot . "pg/pages/owned/" . $_SESSION['user']->username, 'pageslinksgeneral'); -t if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); -t add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); - -t include($CONFIG->pluginspath . "pages/edit.php"); -t break; -t case "view" : -t -t if (isset($page[1])) -t set_input('page_guid', $page[1]); -t -t elgg_extend_view('metatags','pages/metatags'); -t -t $entity = get_entity($page[1]); -t //add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); -t if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); -t add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); -t -t include($CONFIG->pluginspath . "pages/view.php"); -t break; -t case "history" : -t if (isset($page[1])) -t set_input('page_guid', $page[1]); -t -t elgg_extend_view('metatags','pages/metatags'); -t -t $entity = get_entity($page[1]); -t add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); -t if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); -t add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); -t -t include($CONFIG->pluginspath . "pages/history.php"); -t break; -t default: -t include($CONFIG->pluginspath . "pages/new.php"); -t break; - } - } - - } - - /** - * Returns a more meaningful message - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - */ - function page_notify_message($hook, $entity_type, $returnvalue, $params) - { - $entity = $params['entity']; - $to_entity = $params['to_entity']; - $method = $params['method']; - if (($entity instanceof ElggEntity) && (($entity->getSubtype() == 'page_top') || ($entity->getSubtype() == 'page'))) - { - $descr = $entity->description; - $title = $entity->title; - global $CONFIG; - $url = $CONFIG->wwwroot . "pg/view/" . $entity->guid; - if ($method == 'sms') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $url . ' (' . $title . ')'; - } - if ($method == 'email') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); - } - if ($method == 'web') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); - } - } - return null; - } - - - /** - * Sets the parent of the current page, for navigation purposes - * - * @param ElggObject $entity - */ - function pages_set_navigation_parent(ElggObject $entity) { - - $guid = $entity->getGUID(); - - while ($parent_guid = $entity->parent_guid) { - $entity = get_entity($parent_guid); - if ($entity) { - $guid = $entity->getGUID(); - } - } - - set_input('treeguid',$guid); - } - - function pages_get_path($guid) { - - if (!$entity = get_entity($guid)) return array(); - - $path = array($guid); - - while ($parent_guid = $entity->parent_guid) { - $entity = get_entity($parent_guid); - if ($entity) { - $path[] = $entity->getGUID(); - } - } - - return $path; - } - - /** - * Return the correct sidebar for a given entity - * - * @param ElggObject $entity - */ - function pages_get_entity_sidebar(ElggObject $entity, $fulltree = 0) - { - $body = ""; - - $children = elgg_get_entities_from_metadata(array('metadata_names' => 'parent_guid', 'metadata_values' => $entity->guid, 'limit' => 9999)); - $body .= elgg_view('pages/sidebar/sidebarthis', array('entity' => $entity, - 'children' => $children, - 'fulltree' => $fulltree)); - //$body = elgg_view('pages/sidebar/wrapper', array('body' => $body)); - - return $body; - } - - /** - * Extend permissions checking to extend can-edit for write users. - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - */ - function pages_write_permission_check($hook, $entity_type, $returnvalue, $params) - { - if ($params['entity']->getSubtype() == 'page' - || $params['entity']->getSubtype() == 'page_top') { - - $write_permission = $params['entity']->write_access_id; - $user = $params['user']; - - if (($write_permission) && ($user)) - { - // $list = get_write_access_array($user->guid); - $list = get_access_array($user->guid); // get_access_list($user->guid); - - if (($write_permission!=0) && (in_array($write_permission,$list))) - return true; - - } - } - } - - /** - * Extend container permissions checking to extend can_write_to_container for write users. - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - */ - function pages_container_permission_check($hook, $entity_type, $returnvalue, $params) { - - if (get_context() == "pages") { - if (page_owner()) { - if (can_write_to_container($_SESSION['user']->guid, page_owner())) return true; - } - if ($page_guid = get_input('page_guid',0)) { - $entity = get_entity($page_guid); - } else if ($parent_guid = get_input('parent_guid',0)) { - $entity = get_entity($parent_guid); - } - if ($entity instanceof ElggObject) { - if ( - can_write_to_container($_SESSION['user']->guid, $entity->container_guid) - || in_array($entity->write_access_id,get_access_list()) - ) { - return true; - } - } - } - - } - - // write permission plugin hooks - register_plugin_hook('permissions_check', 'object', 'pages_write_permission_check'); - register_plugin_hook('container_permissions_check', 'object', 'pages_container_permission_check'); - - // Make sure the pages initialisation function is called on initialisation - register_elgg_event_handler('init','system','pages_init'); - register_elgg_event_handler('pagesetup','system','pages_submenus'); + /** + * 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')); + } + + // Listen to notification events and supply a more useful message + register_plugin_hook('notify:entity:message', 'object', 'page_notify_message'); + + // add the group pages tool option + add_group_tool_option('pages',elgg_echo('groups:enablepages'),true); + + + //add a widget + add_widget_type('pages',elgg_echo('pages'),elgg_echo('pages:widget:description')); + + // For now, we'll hard code the groups profile items as follows: + // TODO make this user configurable + + // Language short codes must be of the form "pages:key" + // where key is the array key below + $CONFIG->pages = array( + 'title' => 'text', + 'description' => 'longtext', + 'tags' => 'tags', + 'access_id' => 'access', + 'write_access_id' => 'access', + ); + } + + function pages_url($entity) { + + global $CONFIG; + + + return $CONFIG->url . "pg/pages/view/{$entity->guid}/"; + + } + + /** + * Sets up submenus for the pages system. Triggered on pagesetup. + * + */ + function pages_submenus() { + + global $CONFIG; + + $page_owner = page_owner_entity(); + + // Group submenu option + if ($page_owner instanceof ElggGroup && get_context() == 'groups') { + if($page_owner->pages_enable != "no"){ + add_submenu_item(sprintf(elgg_echo("pages:group"),$page_owner->name), $CONFIG->wwwroot . "pg/pages/owned/" . $page_owner->username); + } + } + } + + /** + * Pages page handler. + * + * @param array $page + */ + function pages_page_handler($page) + { + global $CONFIG; + + if (isset($page[0])) + { + // See what context we're using + switch($page[0]) + { + case "new" : + include($CONFIG->pluginspath . "pages/new.php"); + break; + case "welcome" : + include($CONFIG->pluginspath . "pages/welcome.php"); + break; + case "world": + include($CONFIG->pluginspath . "pages/world.php"); + break; + case "owned" : + // Owned by a user + if (isset($page[1])) + set_input('username',$page[1]); + + include($CONFIG->pluginspath . "pages/index.php"); + break; + case "edit" : + if (isset($page[1])) + set_input('page_guid', $page[1]); + + $entity = get_entity($page[1]); + add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); + // add_submenu_item(elgg_echo('pages:user'), $CONFIG->wwwroot . "pg/pages/owned/" . $_SESSION['user']->username, 'pageslinksgeneral'); + if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); + add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); + + include($CONFIG->pluginspath . "pages/edit.php"); + break; + case "view" : + + if (isset($page[1])) + set_input('page_guid', $page[1]); + + elgg_extend_view('metatags','pages/metatags'); + + $entity = get_entity($page[1]); + //add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); + if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); + add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); + + include($CONFIG->pluginspath . "pages/view.php"); + break; + case "history" : + if (isset($page[1])) + set_input('page_guid', $page[1]); + + elgg_extend_view('metatags','pages/metatags'); + + $entity = get_entity($page[1]); + add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); + if (($entity) && ($entity->canEdit())) add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); + add_submenu_item(elgg_echo('pages:label:history'), $CONFIG->url . "pg/pages/history/{$page[1]}", 'pageslinks'); + + include($CONFIG->pluginspath . "pages/history.php"); + break; + default: + include($CONFIG->pluginspath . "pages/new.php"); + break; + } + } + + } + + /** + * Returns a more meaningful message + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + */ + function page_notify_message($hook, $entity_type, $returnvalue, $params) + { + $entity = $params['entity']; + $to_entity = $params['to_entity']; + $method = $params['method']; + if (($entity instanceof ElggEntity) && (($entity->getSubtype() == 'page_top') || ($entity->getSubtype() == 'page'))) + { + $descr = $entity->description; + $title = $entity->title; + global $CONFIG; + $url = $CONFIG->wwwroot . "pg/view/" . $entity->guid; + if ($method == 'sms') { + $owner = $entity->getOwnerEntity(); + return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $url . ' (' . $title . ')'; + } + if ($method == 'email') { + $owner = $entity->getOwnerEntity(); + return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + } + if ($method == 'web') { + $owner = $entity->getOwnerEntity(); + return $owner->name . ' ' . elgg_echo("pages:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); + } + } + return null; + } + + + /** + * Sets the parent of the current page, for navigation purposes + * + * @param ElggObject $entity + */ + function pages_set_navigation_parent(ElggObject $entity) { + + $guid = $entity->getGUID(); + + while ($parent_guid = $entity->parent_guid) { + $entity = get_entity($parent_guid); + if ($entity) { + $guid = $entity->getGUID(); + } + } + + set_input('treeguid',$guid); + } + + function pages_get_path($guid) { + + if (!$entity = get_entity($guid)) return array(); + + $path = array($guid); + + while ($parent_guid = $entity->parent_guid) { + $entity = get_entity($parent_guid); + if ($entity) { + $path[] = $entity->getGUID(); + } + } + + return $path; + } + + /** + * Return the correct sidebar for a given entity + * + * @param ElggObject $entity + */ + function pages_get_entity_sidebar(ElggObject $entity, $fulltree = 0) + { + $body = ""; + + $children = elgg_get_entities_from_metadata(array('metadata_names' => 'parent_guid', 'metadata_values' => $entity->guid, 'limit' => 9999)); + $body .= elgg_view('pages/sidebar/sidebarthis', array('entity' => $entity, + 'children' => $children, + 'fulltree' => $fulltree)); + //$body = elgg_view('pages/sidebar/wrapper', array('body' => $body)); + + return $body; + } + + /** + * Extend permissions checking to extend can-edit for write users. + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + */ + function pages_write_permission_check($hook, $entity_type, $returnvalue, $params) + { + if ($params['entity']->getSubtype() == 'page' + || $params['entity']->getSubtype() == 'page_top') { + + $write_permission = $params['entity']->write_access_id; + $user = $params['user']; + + if (($write_permission) && ($user)) + { + // $list = get_write_access_array($user->guid); + $list = get_access_array($user->guid); // get_access_list($user->guid); + + if (($write_permission!=0) && (in_array($write_permission,$list))) + return true; + + } + } + } + + /** + * Extend container permissions checking to extend can_write_to_container for write users. + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + */ + function pages_container_permission_check($hook, $entity_type, $returnvalue, $params) { + + if (get_context() == "pages") { + if (page_owner()) { + if (can_write_to_container($_SESSION['user']->guid, page_owner())) return true; + } + if ($page_guid = get_input('page_guid',0)) { + $entity = get_entity($page_guid); + } else if ($parent_guid = get_input('parent_guid',0)) { + $entity = get_entity($parent_guid); + } + if ($entity instanceof ElggObject) { + if ( + can_write_to_container($_SESSION['user']->guid, $entity->container_guid) + || in_array($entity->write_access_id,get_access_list()) + ) { + return true; + } + } + } + + } + + // write permission plugin hooks + register_plugin_hook('permissions_check', 'object', 'pages_write_permission_check'); + register_plugin_hook('container_permissions_check', 'object', 'pages_container_permission_check'); + + // Make sure the pages initialisation function is called on initialisation + register_elgg_event_handler('init','system','pages_init'); + register_elgg_event_handler('pagesetup','system','pages_submenus'); ?> diff --git a/mod/pages/views/default/forms/pages/editwelcome.php b/mod/pages/views/default/forms/pages/editwelcome.php index dc8c24b3e..39d8d05ca 100644 --- a/mod/pages/views/default/forms/pages/editwelcome.php +++ b/mod/pages/views/default/forms/pages/editwelcome.php @@ -11,15 +11,15 @@ //set some variables if($vars['entity']){ -t foreach($vars['entity'] as $welcome){ -t t$current_message = $welcome->description; -t t$object_guid = $welcome->guid; -t t$access_id = $welcome->access_id; - t} + foreach($vars['entity'] as $welcome){ + $current_message = $welcome->description; + $object_guid = $welcome->guid; + $access_id = $welcome->access_id; + } }else{ -t $current_message = ''; -t $object_guid = ''; -t $access_id = ACCESS_PRIVATE; + $current_message = ''; + $object_guid = ''; + $access_id = ACCESS_PRIVATE; } $page_owner = $vars['owner']->guid; @@ -27,7 +27,7 @@ t $access_id = ACCESS_PRIVATE; ?> <form action="<?php echo $vars['url']; ?>action/pages/editwelcome" method="post"> -t<p class="longtext_inputarea"> + <p class="longtext_inputarea"> <label> <?php echo elgg_view("input/longtext",array( 'internalname' => "pages_welcome", @@ -47,13 +47,13 @@ t<p class="longtext_inputarea"> <?php echo elgg_view('input/securitytoken'); - t//if it is editing, include the object guid - tif($object_guid != ''){ -t?> - t<input type="hidden" name="object_guid" value="<?php echo $object_guid; ?>" /> + //if it is editing, include the object guid + if($object_guid != ''){ + ?> + <input type="hidden" name="object_guid" value="<?php echo $object_guid; ?>" /> <?php -tt} -t?> -t + } + ?> + <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" /> </form> diff --git a/mod/pages/views/default/pages/breadcrumbs.php b/mod/pages/views/default/pages/breadcrumbs.php index eddcfa7df..a6626ca39 100644 --- a/mod/pages/views/default/pages/breadcrumbs.php +++ b/mod/pages/views/default/pages/breadcrumbs.php @@ -4,25 +4,25 @@ $parent = $vars['parent']; $breadcrumbs = ''; - t - t$owner_url = $CONFIG->wwwroot . "pg/pages/owned/" . get_entity($page_owner)->username; - techo "<div id='breadcrumbs'><b><a href=\"{$owner_url}\">" . elgg_echo('pages:user') . "</a></b>"; - t - t//see if the new page's parent has a parent -tt$getparent = get_entity($parent->parent_guid); -ttwhile ($getparent instanceof ElggObject){ -ttt -ttt $breadcrumbs = " > <a href=\"{$getparent->getURL()}\">$getparent->title</a>" . $breadcrumbs; -ttt $getparent = get_entity($getparent->parent_guid); -ttt -tt} -tt -ttecho $breadcrumbs; -tt//if it is adding a page, make the last page a link, otherwise, don't -ttif($vars['add']){ - ttecho " > <a href=\"{$parent->getURL()}\">$parent->title</a></div>"; -tt}else{ -tttecho " > $parent->title</div>"; -tt} + + $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>"; + } ?> diff --git a/mod/pages/views/default/pages/css.php b/mod/pages/views/default/pages/css.php index 0320836b9..c396d45f7 100644 --- a/mod/pages/views/default/pages/css.php +++ b/mod/pages/views/default/pages/css.php @@ -84,19 +84,19 @@ } #pages_page .strapline { -ttext-align:right; -tborder-top:1px solid #efefef; -tmargin:10px 0 10px 0; -tcolor:#666666; + text-align:right; + border-top:1px solid #efefef; + margin:10px 0 10px 0; + color:#666666; } #pages_page .categories { -tborder:none !important; -tpadding:0 !important; + border:none !important; + padding:0 !important; } #pages_page .tags { -tpadding:0 0 0 16px; -tmargin: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; } @@ -117,8 +117,8 @@ tmargin:10px 0 4px 0; background:white; -webkit-border-radius: 8px; -moz-border-radius: 8px; -tpadding:10px; -tmargin:0 10px 10px 10px; + padding:10px; + margin:0 10px 10px 10px; } #sidebar_page_tree h3 { background: none; diff --git a/mod/pages/views/default/pages/groupprofile_pages.php b/mod/pages/views/default/pages/groupprofile_pages.php index 323b02f2b..006a05877 100644 --- a/mod/pages/views/default/pages/groupprofile_pages.php +++ b/mod/pages/views/default/pages/groupprofile_pages.php @@ -1,9 +1,9 @@ <?php -t// pages on the group index page + // pages on the group index page -t//check to make sure this group forum has been activated -tif($vars['entity']->pages_enable != 'no'){ + //check to make sure this group forum has been activated + if($vars['entity']->pages_enable != 'no'){ ?> @@ -11,9 +11,9 @@ tif($vars['entity']->pages_enable != 'no'){ <h2><?php echo elgg_echo("pages:groupprofile"); ?></h2> <?php -t$objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => 5, 'full_view' => FALSE)); + $objects = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => 5, 'full_view' => FALSE)); -tif($objects) + if($objects) echo $objects; else echo "<div class=\"forum_latest\">" . elgg_echo("pages:nogroup") . "</div>"; @@ -23,5 +23,5 @@ tif($objects) </div> <?php -t} + } ?> diff --git a/mod/pages/views/default/pages/pageprofile.php b/mod/pages/views/default/pages/pageprofile.php index 93191967c..b1081d9f7 100644 --- a/mod/pages/views/default/pages/pageprofile.php +++ b/mod/pages/views/default/pages/pageprofile.php @@ -66,7 +66,7 @@ <p class="strapline"> <?php -tttt + $time_updated = $latest->time_created; $owner_guid = $latest->owner_guid; $owner = get_entity($owner_guid); diff --git a/mod/pages/views/default/pages/sidebar/tree.php b/mod/pages/views/default/pages/sidebar/tree.php index 768127e9c..07de1beb5 100644 --- a/mod/pages/views/default/pages/sidebar/tree.php +++ b/mod/pages/views/default/pages/sidebar/tree.php @@ -2,7 +2,7 @@ ?> <div id="sidebar_page_tree"> - t<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/welcome.php b/mod/pages/views/default/pages/welcome.php index beb58bef3..a390a9d65 100644 --- a/mod/pages/views/default/pages/welcome.php +++ b/mod/pages/views/default/pages/welcome.php @@ -1,6 +1,6 @@ <?php -t/** + /** * Elgg Pages welcome message * * @package ElggPages @@ -11,19 +11,19 @@ t/** */ if($vars['entity']){ -t -t foreach($vars['entity'] as $welcome){ -t -t techo "<div class=\"contentWrapper pageswelcome\">" . $welcome->description . "</div>"; -t t - t} -t + + 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> -t + <?php -t} + } ?> diff --git a/mod/pages/views/default/river/object/page/update.php b/mod/pages/views/default/river/object/page/update.php index e08a26b85..2b20a9ed8 100644 --- a/mod/pages/views/default/river/object/page/update.php +++ b/mod/pages/views/default/river/object/page/update.php @@ -8,7 +8,7 @@ $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>"; -t + ?> <?php echo $string; ?> 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 1e7333515..febe2965d 100644 --- a/mod/pages/views/default/river/object/page_top/update.php +++ b/mod/pages/views/default/river/object/page_top/update.php @@ -6,9 +6,9 @@ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $string = sprintf(elgg_echo("pages:river:updated"),$url) . " "; -t$string .= elgg_echo("pages:river:update") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; + $string .= elgg_echo("pages:river:update") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; //$string .= "<div class=\"river_content\">Title: " . $object->title . "</div>"; -t + ?> <?php echo $string; ?> diff --git a/mod/pages/views/default/widgets/pages/edit.php b/mod/pages/views/default/widgets/pages/edit.php index ccef69c06..6459a0373 100644 --- a/mod/pages/views/default/widgets/pages/edit.php +++ b/mod/pages/views/default/widgets/pages/edit.php @@ -1,6 +1,6 @@ <?php -t/** + /** * Elgg pages widget edit * * @package ElggPages diff --git a/mod/pages/views/default/widgets/pages/view.php b/mod/pages/views/default/widgets/pages/view.php index 0ea1e2056..d975dcdc0 100644 --- a/mod/pages/views/default/widgets/pages/view.php +++ b/mod/pages/views/default/widgets/pages/view.php @@ -1,11 +1,11 @@ <style type="text/css"> #pages_widget .pagination { -tdisplay:none; + display:none; } </style> <?php -t /** + /** * Elgg pages widget edit * * @package ElggPages @@ -14,19 +14,19 @@ t /** * @copyright Curverider Ltd 2008-2010 * @link http://elgg.com/ */ -t -t $num_display = (int) $vars['entity']->pages_num; + + $num_display = (int) $vars['entity']->pages_num; if (!$num_display) { $num_display = 4; } -t -t $pages = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => $num_display, 'full_view' => FALSE)); + + $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>"; } -t echo "<div id=\"pages_widget\">" . $pages . "</div>"; -t + echo "<div id=\"pages_widget\">" . $pages . "</div>"; + ?> diff --git a/mod/pages/welcome.php b/mod/pages/welcome.php index 8c9228e63..3ff0c3aae 100644 --- a/mod/pages/welcome.php +++ b/mod/pages/welcome.php @@ -23,12 +23,12 @@ $page_owner = $_SESSION['user']; set_page_owner($page_owner->getGUID()); } -t + //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'); -t + $title = elgg_echo("pages:welcome"); $area2 .= elgg_view_title($title); $area2 .= elgg_view("forms/pages/editwelcome", array('entity' => $welcome_message, 'owner' => $page_owner)); diff --git a/mod/pages/world.php b/mod/pages/world.php index 2b6385745..65f054dfb 100644 --- a/mod/pages/world.php +++ b/mod/pages/world.php @@ -20,16 +20,16 @@ set_page_owner($_SESSION['guid']); } -tif (($page_owner instanceof ElggEntity) && ($page_owner->canWriteToContainer())){ -ttadd_submenu_item(elgg_echo('pages:new'), $CONFIG->url . "pg/pages/new/", 'pagesactions'); -ttadd_submenu_item(elgg_echo('pages:welcome'), $CONFIG->url . "pg/pages/welcome/", 'pagesactions'); -t} -t -tif(isloggedin()) -t add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); -t -tadd_submenu_item(elgg_echo('pages:all'),$CONFIG->wwwroot."mod/pages/world.php", 'pageslinksgeneral'); -t + 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); |