From 4caa18176ab7b25896596276ee5a3d724a5915fd Mon Sep 17 00:00:00 2001 From: Matt Beckett Date: Sat, 19 May 2012 01:54:51 -0600 Subject: Initial Commit --- river_privacy/CHANGES.txt | 7 ++ river_privacy/languages/en.php | 13 ++++ river_privacy/manifest.xml | 18 +++++ river_privacy/start.php | 30 ++++++++ .../default/plugins/river_privacy/settings.php | 17 +++++ .../default/page/components/list.php | 86 ++++++++++++++++++++++ 6 files changed, 171 insertions(+) create mode 100644 river_privacy/CHANGES.txt create mode 100644 river_privacy/languages/en.php create mode 100644 river_privacy/manifest.xml create mode 100644 river_privacy/start.php create mode 100644 river_privacy/views/default/plugins/river_privacy/settings.php create mode 100644 river_privacy/views_override/default/page/components/list.php diff --git a/river_privacy/CHANGES.txt b/river_privacy/CHANGES.txt new file mode 100644 index 000000000..df26e881d --- /dev/null +++ b/river_privacy/CHANGES.txt @@ -0,0 +1,7 @@ +== Version History == + +x.x: + +1.0 (05/19/2012): + +- Initial Release \ No newline at end of file diff --git a/river_privacy/languages/en.php b/river_privacy/languages/en.php new file mode 100644 index 000000000..f0cfde2a1 --- /dev/null +++ b/river_privacy/languages/en.php @@ -0,0 +1,13 @@ + "River Privacy", + 'river_privacy:hide_old:description' => "Only items that are created after this plugin is enabled + will be set to private. This setting can allow old items to be hidden - this is done at + display time, so it may affect layout (eg. 20 items are expected to be shown, but only 15 are + visible because 5 of them are filtered out by this plugin). + Note that new items created will be private regardless of this setting, this setting is only for old items.", + 'river_privacy:hide_old:label' => "Hide old river entries?", +); + +add_translation("en",$english); diff --git a/river_privacy/manifest.xml b/river_privacy/manifest.xml new file mode 100644 index 000000000..36ed40f92 --- /dev/null +++ b/river_privacy/manifest.xml @@ -0,0 +1,18 @@ + + + River Privacy + Matt Beckett (matt@clever-name.com) + 1.0 + Sets non-object oriented river items to private access (eg. friend relationships) + http://landing.athabascau.ca + (C) Matt Beckett, 2012 + GNU Public License version 2 + + + + elgg_release + 1.8 + + + Miscellaneous + diff --git a/river_privacy/start.php b/river_privacy/start.php new file mode 100644 index 000000000..b836ded52 --- /dev/null +++ b/river_privacy/start.php @@ -0,0 +1,30 @@ + 'params[hide_old_items]', + 'value' => $vars['entity']->hide_old_items ? $vars['entity']->hide_old_items : 'yes', + 'options_values' => array( + 'yes' => elgg_echo('option:yes'), + 'no' => elgg_echo('option:no'), + ), +); + +echo elgg_echo('river_privacy:hide_old:label') . "
"; +echo elgg_view('input/dropdown', $options); + +echo "

" . elgg_echo('river_privacy:hide_old:description'); + +echo "

"; \ No newline at end of file diff --git a/river_privacy/views_override/default/page/components/list.php b/river_privacy/views_override/default/page/components/list.php new file mode 100644 index 000000000..b34c454a6 --- /dev/null +++ b/river_privacy/views_override/default/page/components/list.php @@ -0,0 +1,86 @@ + element + * @uses $vars['item_class'] Additional CSS class for the
  • elements + */ + +$items = $vars['items']; +$offset = elgg_extract('offset', $vars); +$limit = elgg_extract('limit', $vars); +$count = elgg_extract('count', $vars); +$base_url = elgg_extract('base_url', $vars, ''); +$pagination = elgg_extract('pagination', $vars, true); +$offset_key = elgg_extract('offset_key', $vars, 'offset'); +$position = elgg_extract('position', $vars, 'after'); + +// remove non-object items for anyone who's not the subject +if(is_array($items) && ($items[0] instanceof ElggRiverItem)){ + foreach($items as $key => $item){ + if($item->type != 'object' && $item->subject_guid != elgg_get_logged_in_user_guid()){ + unset($items[$key]); + } + } +} + +// reset key values +$items = array_merge(array(), $items); + +$list_class = 'elgg-list'; +if (isset($vars['list_class'])) { + $list_class = "$list_class {$vars['list_class']}"; +} + +$item_class = 'elgg-item'; +if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; +} + +$html = ""; +$nav = ""; + +if ($pagination && $count) { + $nav .= elgg_view('navigation/pagination', array( + 'base_url' => $base_url, + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, + 'offset_key' => $offset_key, + )); +} + +if (is_array($items) && count($items) > 0) { + $html .= "'; +} + +if ($position == 'before' || $position == 'both') { + $html = $nav . $html; +} + +if ($position == 'after' || $position == 'both') { + $html .= $nav; +} + +echo $html; -- cgit v1.2.3