diff options
Diffstat (limited to 'mod/pages/views')
-rw-r--r-- | mod/pages/views/default/annotation/icon.php | 26 | ||||
-rw-r--r-- | mod/pages/views/default/annotation/page.php | 42 | ||||
-rw-r--r-- | mod/pages/views/default/forms/pages/edit.php | 104 | ||||
-rw-r--r-- | mod/pages/views/default/object/page.php | 10 | ||||
-rw-r--r-- | mod/pages/views/default/object/page_top.php | 51 | ||||
-rw-r--r-- | mod/pages/views/default/pages/css.php | 5 | ||||
-rw-r--r-- | mod/pages/views/default/pages/group_module.php | 51 | ||||
-rw-r--r-- | mod/pages/views/default/pages/groupprofile_pages.php | 28 | ||||
-rw-r--r-- | mod/pages/views/default/pages/icon.php | 27 | ||||
-rw-r--r-- | mod/pages/views/default/pages/pagegallery.php | 31 | ||||
-rw-r--r-- | mod/pages/views/default/pages/pagelisting.php | 32 | ||||
-rw-r--r-- | mod/pages/views/default/pages/pageprofile.php | 74 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/navigation.php | 16 | ||||
-rw-r--r-- | mod/pages/views/default/widgets/pages/content.php | 38 | ||||
-rw-r--r-- | mod/pages/views/default/widgets/pages/edit.php | 24 |
15 files changed, 220 insertions, 339 deletions
diff --git a/mod/pages/views/default/annotation/icon.php b/mod/pages/views/default/annotation/icon.php deleted file mode 100644 index 42d32b021..000000000 --- a/mod/pages/views/default/annotation/icon.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * @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 = ""; -} - -?> - -<div class="groupicon"> -<a href="<?php echo $entity->getURL() . "?rev=" . $annotation->id; ?>"><img src="<?php echo $entity->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> <?php echo $vars['js']; ?> /></a> -</div> diff --git a/mod/pages/views/default/annotation/page.php b/mod/pages/views/default/annotation/page.php index 53f38831f..87d32e23b 100644 --- a/mod/pages/views/default/annotation/page.php +++ b/mod/pages/views/default/annotation/page.php @@ -1,34 +1,40 @@ <?php /** - * Default page listing? + * Revision view for history page * * @package ElggPages */ $annotation = $vars['annotation']; -$entity = get_entity($annotation->entity_guid); +$page = get_entity($annotation->entity_guid); -$icon = elgg_view( - "annotation/icon", array( - 'annotation' => $vars['annotation'], - 'size' => 'small', - ) -); +$icon = elgg_view("pages/icon", array( + 'annotation' => $annotation, + 'size' => 'small', +)); $owner_guid = $annotation->owner_guid; $owner = get_entity($owner_guid); +if (!$owner) { -$rev = elgg_echo('pages:revision', - array(elgg_view_friendly_time($annotation->time_created)), - "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>" -); +} +$owner_link = elgg_view('output/url', array( + 'href' => $owner->getURL(), + 'text' => $owner->name, +)); -$link = $entity->getURL() . "?rev=" . $annotation->id; +$date = elgg_view_friendly_time($annotation->time_created); -$info = <<< END +$title_link = elgg_view('output/url', array( + 'href' => $annotation->getURL(), + 'text' => $page->title, +)); -<div><a href="$link">{$entity->title}</a></div> -<div>$rev</div> -END; +$subtitle = elgg_echo('pages:revision:subtitle', array($date, $owner_link)); -echo elgg_view_listing($icon, $info); +$body = <<< HTML +<h3>$title_link</h3> +<p class="elgg-subtitle">$subtitle</p> +HTML; + +echo elgg_view_image_block($icon, $body);
\ No newline at end of file diff --git a/mod/pages/views/default/forms/pages/edit.php b/mod/pages/views/default/forms/pages/edit.php index 94e969a57..e4188a29b 100644 --- a/mod/pages/views/default/forms/pages/edit.php +++ b/mod/pages/views/default/forms/pages/edit.php @@ -5,92 +5,44 @@ * @package ElggPages */ -$parent_guid = get_input('parent_guid'); -$container_guid = get_input('container_guid'); -if (!$container_guid) { - $container_guid = elgg_get_page_owner_guid(); -} - -$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; - } - - // 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 elgg_get_site_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) { +$variables = elgg_get_config('pages'); +foreach ($variables as $name => $type) { ?> - <p> - <label> - <?php echo elgg_echo("pages:{$shortname}") ?><br /> - <?php echo elgg_view("input/{$valtype}",array( - 'internalname' => $shortname, - 'value' => $vars['entity']->$shortname - )); ?> - </label> + <label><?php echo elgg_echo("pages:$name") ?></label><br /> + <?php echo elgg_view("input/$type", array( + 'internalname' => $name, + 'value' => $vars[$name], + )); + ?> </p> - <?php - - } } $cats = elgg_view('categories', $vars); if (!empty($cats)) { -?> -<p> - <?php - echo $cats; - ?> -</p> -<?php + echo "<p>$cats</p>"; +} - } -?> -<p> -<?php -if (!$new_page) { - ?><input type="hidden" name="pages_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /><?php +echo '<p>'; +if ($vars['guid']) { + echo elgg_view('input/hidden', array( + 'internalname' => 'page_guid', + 'value' => $vars['guid'], + )); } - -if ($container_guid) { - ?><input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" /><?php +echo elgg_view('input/hidden', array( + 'internalname' => 'container_guid', + 'value' => $vars['container_guid'], +)); +if ($vars['parent_guid']) { + echo elgg_view('input/hidden', array( + 'internalname' => 'parent_guid', + 'value' => $vars['parent_guid'], + )); } -?> - <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 elgg_get_page_owner_guid(); ?>" /> -<?php - echo elgg_view('input/submit', array('value' => elgg_echo('save'))); -?> -</p> -</form> -</div>
\ No newline at end of file +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); + +echo '</p>'; diff --git a/mod/pages/views/default/object/page.php b/mod/pages/views/default/object/page.php index dbca0755b..a5e56415d 100644 --- a/mod/pages/views/default/object/page.php +++ b/mod/pages/views/default/object/page.php @@ -5,12 +5,4 @@ * @package ElggPages */ -if ($vars['full']) { - echo elgg_view("pages/pageprofile", $vars); -} else { - if (get_input('listtype') == "gallery") { - echo elgg_view('pages/pagegallery', $vars); - } else { - echo elgg_view("pages/pagelisting", $vars); - } -}
\ No newline at end of file +echo elgg_view('object/page_top', $vars); diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php index d1a9ef7e8..9770dce23 100644 --- a/mod/pages/views/default/object/page_top.php +++ b/mod/pages/views/default/object/page_top.php @@ -3,30 +3,45 @@ * View for page object * * @package ElggPages + * + * @uses $vars['entity'] The page object + * @uses $vars['full'] Whether to display the full view + * @uses $vars['revision'] This parameter not supported by elgg_view_entity() */ $full = elgg_get_array_value('full', $vars, FALSE); $page = elgg_get_array_value('entity', $vars, FALSE); +$revision = elgg_get_array_value('revision', $vars, FALSE); if (!$page) { return TRUE; } -$owner = $page->getOwnerEntity(); -$owner_icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny')); -$owner_link = elgg_view('output/url', array( - 'href' => "pg/pages/owner/$owner->username", - 'text' => $owner->name, +if ($revision) { + $annotation = $revision; +} else { + $annotation = $page->getAnnotations('page', 1, 0, 'desc'); + if ($annotation) { + $annotation = $annotation[0]; + } +} + +$page_icon = elgg_view('pages/icon', array('annotation' => $annotation, 'size' => 'small')); + +$editor = get_entity($annotation->owner_guid); +$editor_link = elgg_view('output/url', array( + 'href' => "pg/pages/owner/$editor->username", + 'text' => $editor->name, )); -$author_text = elgg_echo('blog:author_by_line', array($owner_link)); + +$date = elgg_view_friendly_time($annotation->time_created); +$editor_text = elgg_echo('pages:strapline', array($date, $editor_link)); $tags = elgg_view('output/tags', array('tags' => $page->tags)); -$date = elgg_view_friendly_time($page->time_created); -$excerpt = elgg_get_excerpt($page->description); $comments_count = elgg_count_comments($page); //only display if there are commments -if ($comments_count != 0) { +if ($comments_count != 0 && !$revision) { $text = elgg_echo("comments") . " ($comments_count)"; $comments_link = elgg_view('output/url', array( 'href' => $page->getURL() . '#page-comments', @@ -36,20 +51,26 @@ if ($comments_count != 0) { $comments_link = ''; } +$history_link = elgg_view('output/url', array( + 'href' => "pg/pages/history/$page->guid", + 'text' => elgg_echo('pages:history'), +)); + $metadata = elgg_view('layout/objects/list/metadata', array( 'entity' => $page, 'handler' => 'pages', + 'links' => array($history_link), )); -$subtitle = "$author_text $date $categories $comments_link"; +$subtitle = "$editor_text $categories $comments_link"; // do not show the metadata and controls in widget view -if (elgg_in_context('widgets')) { +if (elgg_in_context('widgets') || $revision) { $metadata = ''; } if ($full) { - $body = elgg_view('output/longtext', array('value' => $page->description)); + $body = elgg_view('output/longtext', array('value' => $annotation->value)); $params = array( 'entity' => $page, @@ -60,7 +81,7 @@ if ($full) { ); $list_body = elgg_view('layout/objects/list/body', $params); - $info = elgg_view_image_block($owner_icon, $list_body); + $info = elgg_view_image_block($page_icon, $list_body); echo <<<HTML $info @@ -70,6 +91,8 @@ HTML; } else { // brief view + $excerpt = elgg_get_excerpt($page->description); + $params = array( 'entity' => $page, 'metadata' => $metadata, @@ -79,5 +102,5 @@ HTML; ); $list_body = elgg_view('layout/objects/list/body', $params); - echo elgg_view_image_block($owner_icon, $list_body); + echo elgg_view_image_block($page_icon, $list_body); } diff --git a/mod/pages/views/default/pages/css.php b/mod/pages/views/default/pages/css.php index 48991b904..245c39b47 100644 --- a/mod/pages/views/default/pages/css.php +++ b/mod/pages/views/default/pages/css.php @@ -6,6 +6,11 @@ */ ?> +.pages-nav .elgg-child-menu { + display: none; + margin-left: 15px; +} + .treeview, .treeview ul { padding: 0; margin: 0; 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..2e6b7f6ec --- /dev/null +++ b/mod/pages/views/default/pages/group_module.php @@ -0,0 +1,51 @@ +<?php +/** + * Group pages + * + * @package ElggPages + */ + + +$group = elgg_get_page_owner(); + +if ($group->pages_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "pg/pages/group/$group->guid/owner", + 'text' => elgg_echo('link:view:all'), +)); + +$header = "<span class=\"group-widget-viewall\">$all_link</span>"; +$header .= '<h3>' . elgg_echo('pages:group') . '</h3>'; + + +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' => "pg/pages/add/$group->guid", + 'text' => elgg_echo('pages:add'), +)); +$content .= "<span class='elgg-widget-more'>$new_link</span>"; + + +$params = array( + 'header' => $header, + 'body' => $content, +); +echo elgg_view('layout/objects/module', $params); diff --git a/mod/pages/views/default/pages/groupprofile_pages.php b/mod/pages/views/default/pages/groupprofile_pages.php deleted file mode 100644 index 8069cdd8b..000000000 --- a/mod/pages/views/default/pages/groupprofile_pages.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * 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' => elgg_get_page_owner_guid(), '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/icon.php b/mod/pages/views/default/pages/icon.php new file mode 100644 index 000000000..fd084bca7 --- /dev/null +++ b/mod/pages/views/default/pages/icon.php @@ -0,0 +1,27 @@ +<?php +/** + * Page icon + * + * @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"; +} + +if (!empty($vars['align'])) { + $align = " align=\"{$vars['align']}\" "; +} else { + $align = ""; +} + +?> + +<a href="<?php echo $annotation->getURL(); ?>"><img src="<?php echo $entity->getIcon($vars['size']); ?>" <?php echo $align; ?> /></a> diff --git a/mod/pages/views/default/pages/pagegallery.php b/mod/pages/views/default/pages/pagegallery.php deleted file mode 100644 index 0dadb63c2..000000000 --- a/mod/pages/views/default/pages/pagegallery.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * Elgg Pages gallery listing. - * - * @package ElggPages - */ - -$icon = elgg_view( - "graphics/icon", array( - 'entity' => $vars['entity'], - 'size' => 'medium', - ) -); - -$info = "<div><p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->title . "</a></b></p></div>"; - -$latest = $vars['entity']->getAnnotations('page', 1, 0, 'desc'); -if ($latest) { - $latest = $latest[0]; - - $time_updated = $latest->time_created; - $owner_guid = $latest->owner_guid; - $owner = get_entity($owner_guid); - - - $info .= "<br /><div>". - strip_tags(substr($latest->value, 0, 100)) - . "</div>"; -} - -echo elgg_view_listing($icon, $info);
\ No newline at end of file diff --git a/mod/pages/views/default/pages/pagelisting.php b/mod/pages/views/default/pages/pagelisting.php deleted file mode 100644 index b5034313f..000000000 --- a/mod/pages/views/default/pages/pagelisting.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/** - * Elgg Pages flat listing - * - * @package ElggPages - */ - -$icon = elgg_view( - "graphics/icon", array( - 'entity' => $vars['entity'], - 'size' => 'small', - ) - ); - -$info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->title . "</a></b></p>"; - -$latest = $vars['entity']->getAnnotations('page', 1, 0, 'desc'); -if ($latest) { - $latest = $latest[0]; - - $time_updated = $latest->time_created; - $owner_guid = $latest->owner_guid; - $owner = get_entity($owner_guid); - - - $info .= "<p class=\"owner_timestamp\">" . elgg_echo("pages:strapline", - array(elgg_view_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 deleted file mode 100644 index f8399556a..000000000 --- a/mod/pages/views/default/pages/pageprofile.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * 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) { - echo elgg_view('output/longtext', array('value' => /*$entity->description*/ $latest->value)); - - $tags = $vars['entity']->tags; - if (!empty($tags)) { - - ?> - <!-- display tags --> - <p class="tags"> - <?php - - echo elgg_view('output/tags', array('tags' => $tags)); - - ?> - </p> - - <?php - - } - $cats = elgg_view('categories/view',$vars); - if (!empty($cats)) { - - ?> - <p class="categories"> - <?php echo $cats; ?> - </p> - <?php - - } - } - - // last edit & by whome - ?> - - <p class="strapline"> - <?php - - $time_updated = $latest->time_created; - $owner_guid = $latest->owner_guid; - $owner = get_entity($owner_guid); - - echo elgg_echo("pages:strapline", - array(elgg_view_friendly_time($time_updated), - "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>" - )); - - ?> - </p> - </div> - -</div> 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..ddd931dab --- /dev/null +++ b/mod/pages/views/default/pages/sidebar/navigation.php @@ -0,0 +1,16 @@ +<?php +/** + * Navigation menu for a user's or a group's pages + */ + +$title = elgg_echo('pages:navigation'); + +pages_register_navigation_tree(elgg_get_page_owner()); + +$content = elgg_view_menu('pages_nav', array('class' => 'pages-nav')); + +echo elgg_view('layout/objects/module', array( + 'title' => $title, + 'body' => $content, + 'class' => 'elgg-aside-module', +)); diff --git a/mod/pages/views/default/widgets/pages/content.php b/mod/pages/views/default/widgets/pages/content.php index f42a1a85f..63a2d8e7e 100644 --- a/mod/pages/views/default/widgets/pages/content.php +++ b/mod/pages/views/default/widgets/pages/content.php @@ -1,27 +1,31 @@ -<style type="text/css"> -#pages_widget .pagination { - display:none; -} -</style> <?php - /** - * Elgg pages widget edit + * Elgg pages widget * * @package ElggPages */ -$num_display = (int) $vars['entity']->pages_num; +$num = (int) $vars['entity']->pages_num; -if (!$num_display) { - $num_display = 4; -} +$options = array( + 'type' => 'object', + 'subtype' => 'page_top', + 'container_guid' => $vars['entity']->owner_guid, + 'limit' => $num, + 'full_view' => FALSE, + 'pagination' => FALSE, +); +$content = elgg_list_entities($options); -$pages = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => elgg_get_page_owner_guid(), 'limit' => $num_display, 'full_view' => FALSE)); +echo $content; -if ($pages) { - $pagesurl = elgg_get_site_url() . "pg/pages/owned/" . elgg_get_page_owner()->username; - $pages .= "<div class=\"pages_widget_singleitem_more\"><a href=\"{$pagesurl}\">" . elgg_echo('pages:more') . "</a></div>"; +if ($content) { + $url = "pg/pages/owner/" . elgg_get_page_owner()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('pages:more'), + )); + echo "<span class=\"elgg-widget-more\">$more_link</span>"; +} else { + echo elgg_echo('pages:none'); } - -echo "<div id=\"pages_widget\">" . $pages . "</div>";
\ 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 4ddfec428..7e76e69d5 100644 --- a/mod/pages/views/default/widgets/pages/edit.php +++ b/mod/pages/views/default/widgets/pages/edit.php @@ -5,24 +5,20 @@ * @package ElggPages */ +// set default value if (!isset($vars['entity']->pages_num)) { $vars['entity']->pages_num = 4; } -?> -<p> -<?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) { - $selected = "selected='selected'"; - } +$params = array( + 'internalname' => 'params[pages_num]', + 'value' => $vars['entity']->pages_num, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), +); +$dropdown = elgg_view('input/pulldown', $params); - echo " <option value='{$i}' $selected >{$i}</option>\n"; -} ?> -</select> +<p> + <?php echo elgg_echo('pages:num'); ?>: + <?php echo $dropdown; ?> </p> |