diff options
Diffstat (limited to 'mod/pages/views/default/pages')
-rw-r--r-- | mod/pages/views/default/pages/css.php | 19 | ||||
-rw-r--r-- | mod/pages/views/default/pages/group_module.php | 49 | ||||
-rw-r--r-- | mod/pages/views/default/pages/icon.php | 25 | ||||
-rw-r--r-- | mod/pages/views/default/pages/input/parent.php | 37 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar.php | 14 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/history.php | 20 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/navigation.php | 58 |
7 files changed, 222 insertions, 0 deletions
diff --git a/mod/pages/views/default/pages/css.php b/mod/pages/views/default/pages/css.php new file mode 100644 index 000000000..24e45cb9d --- /dev/null +++ b/mod/pages/views/default/pages/css.php @@ -0,0 +1,19 @@ +<?php +/** + * Elgg Pages CSS + * + * @package ElggPages + */ +?> + +.pages-nav.treeview ul { + background-color: transparent; +} + +.pages-nav.treeview a.selected { + color: #555555; +} + +.pages-nav.treeview .hover { + color: #0054a7; +}
\ No newline at end of file diff --git a/mod/pages/views/default/pages/group_module.php b/mod/pages/views/default/pages/group_module.php new file mode 100644 index 000000000..0d7df96ac --- /dev/null +++ b/mod/pages/views/default/pages/group_module.php @@ -0,0 +1,49 @@ +<?php +/** + * Group pages + * + * @package ElggPages + */ + + +$group = elgg_get_page_owner_entity(); + +if ($group->pages_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "pages/group/$group->guid/all", + 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, +)); + + +elgg_push_context('widgets'); +$options = array( + 'type' => 'object', + 'subtype' => 'page_top', + 'container_guid' => elgg_get_page_owner_guid(), + 'limit' => 6, + 'full_view' => false, + 'pagination' => false, +); +$content = elgg_list_entities($options); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('pages:none') . '</p>'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "pages/add/$group->guid", + 'text' => elgg_echo('pages:add'), + 'is_trusted' => true, +)); + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('pages:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +)); diff --git a/mod/pages/views/default/pages/icon.php b/mod/pages/views/default/pages/icon.php new file mode 100644 index 000000000..cba034ec4 --- /dev/null +++ b/mod/pages/views/default/pages/icon.php @@ -0,0 +1,25 @@ +<?php +/** + * Page icon + * + * Uses a separate icon view due to dependency on annotation + * + * @package ElggPages + * + * @uses $vars['entity'] + * @uses $vars['annotation'] + */ + +$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"; +} + +?> + +<a href="<?php echo $annotation->getURL(); ?>"> + <img alt="<?php echo $entity->title; ?>" src="<?php echo $entity->getIconURL($vars['size']); ?>" /> +</a> diff --git a/mod/pages/views/default/pages/input/parent.php b/mod/pages/views/default/pages/input/parent.php new file mode 100644 index 000000000..c5ee3c3fb --- /dev/null +++ b/mod/pages/views/default/pages/input/parent.php @@ -0,0 +1,37 @@ +<?php +/** + * Parent picker + * + * @uses $vars['value'] The current value, if any + * @uses $vars['options_values'] + * @uses $vars['name'] The name of the input field + * @uses $vars['entity'] Optional. The child entity (uses container_guid) + */ + +elgg_load_library('elgg:pages'); + +if (empty($vars['entity'])) { + $container = elgg_get_page_owner_entity(); +} else { + $container = $vars['entity']->getContainerEntity(); +} + +$pages = pages_get_navigation_tree($container); +$options = array(); + +foreach ($pages as $page) { + $spacing = ""; + for ($i = 0; $i < $page['depth']; $i++) { + $spacing .= "--"; + } + $options[$page['guid']] = "$spacing " . $page['title']; +} + +$defaults = array( + 'class' => 'elgg-pages-input-parent-picker', + 'options_values' => $options, +); + +$vars = array_merge($defaults, $vars); + +echo elgg_view('input/dropdown', $vars); diff --git a/mod/pages/views/default/pages/sidebar.php b/mod/pages/views/default/pages/sidebar.php new file mode 100644 index 000000000..16fc12de0 --- /dev/null +++ b/mod/pages/views/default/pages/sidebar.php @@ -0,0 +1,14 @@ +<?php +/** + * Pages sidebar + */ + +echo elgg_view('page/elements/comments_block', array( + 'subtypes' => array('page', 'page_top'), + 'owner_guid' => elgg_get_page_owner_guid(), +)); + +echo elgg_view('page/elements/tagcloud_block', array( + 'subtypes' => array('page', 'page_top'), + 'owner_guid' => elgg_get_page_owner_guid(), +));
\ No newline at end of file diff --git a/mod/pages/views/default/pages/sidebar/history.php b/mod/pages/views/default/pages/sidebar/history.php new file mode 100644 index 000000000..7077edb9a --- /dev/null +++ b/mod/pages/views/default/pages/sidebar/history.php @@ -0,0 +1,20 @@ +<?php +/** + * History of this page + * + * @uses $vars['page'] + */ + +$title = elgg_echo('pages:history'); + +if ($vars['page']) { + $options = array( + 'guid' => $vars['page']->guid, + 'annotation_name' => 'page', + 'limit' => 20, + 'reverse_order_by' => true + ); + $content = elgg_list_annotations($options); +} + +echo elgg_view_module('aside', $title, $content);
\ No newline at end of file diff --git a/mod/pages/views/default/pages/sidebar/navigation.php b/mod/pages/views/default/pages/sidebar/navigation.php new file mode 100644 index 000000000..65eb500c8 --- /dev/null +++ b/mod/pages/views/default/pages/sidebar/navigation.php @@ -0,0 +1,58 @@ +<?php +/** + * Navigation menu for a user's or a group's pages + * + * @uses $vars['page'] Page object if manually setting selected item + */ + +// add the jquery treeview files for navigation +elgg_load_js('jquery-treeview'); +elgg_load_css('jquery-treeview'); + + +$selected_page = elgg_extract('page', $vars, false); +if ($selected_page) { + $url = $selected_page->getURL(); +} + +$title = elgg_echo('pages:navigation'); + +pages_register_navigation_tree(elgg_get_page_owner_entity()); + +$content = elgg_view_menu('pages_nav', array('class' => 'pages-nav')); +if (!$content) { + $content = '<p>' . elgg_echo('pages:none') . '</p>'; +} + +echo elgg_view_module('aside', $title, $content); + +?><?php //@todo JS 1.8: no ?> +<script type="text/javascript"> +$(document).ready(function() { + $(".pages-nav").treeview({ + persist: "location", + collapsed: true, + unique: true + }); + +<?php +if ($selected_page) { + // if on a history page, we need to manually select the correct menu item + // code taken from the jquery.treeview library +?> + var current = $(".pages-nav a[href='<?php echo $url; ?>']"); + var items = current.addClass("selected").parents("ul, li").add( current.next() ).show(); + var CLASSES = $.treeview.classes; + items.filter("li") + .swapClass( CLASSES.collapsable, CLASSES.expandable ) + .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) + .find(">.hitarea") + .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) + .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ); +<?php +} +?> + +}); + +</script> |