From c3d5dfec626d2bb48edfe8fae79ff78d2ec64b0e Mon Sep 17 00:00:00 2001
From: Sem <sembrestels@riseup.net>
Date: Thu, 4 Oct 2012 22:00:29 +0200
Subject: Added privacy icons.

---
 views/default/n1_theme/css.php  | 31 ++++++++++++++++++++++++
 views/default/output/access.php | 53 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 views/default/output/access.php

(limited to 'views')

diff --git a/views/default/n1_theme/css.php b/views/default/n1_theme/css.php
index 32267cb..c6a94a8 100644
--- a/views/default/n1_theme/css.php
+++ b/views/default/n1_theme/css.php
@@ -26,6 +26,37 @@
 	font-weight: bold;
 }
 
+.elgg-access, .elgg-input-access > option {
+	padding-left: 19px;
+	background-image: url('<?php echo elgg_get_site_url(); ?>mod/n1_theme/_graphics/privacy.png');
+	background-repeat: no-repeat;
+}
+
+.elgg-access {
+	padding-top: 1px;
+	padding-bottom: 1px;
+}
+
+.elgg-access-private, .elgg-input-access > option[value="<?php echo ACCESS_PRIVATE; ?>"] {
+	background-position: 0 -65px;
+}
+
+.elgg-access-friends, .elgg-input-access > option[value="<?php echo ACCESS_FRIENDS; ?>"] {
+	background-position: 0 -51px;
+}
+
+.elgg-access-loggedin, .elgg-input-access > option[value="<?php echo ACCESS_LOGGED_IN; ?>"] {
+	background-position: 0 -34px;
+}
+
+.elgg-access-public, .elgg-input-access > option[value="<?php echo ACCESS_PUBLIC; ?>"] {
+	background-position: 0 -16px;
+}
+
+.elgg-access-group, .elgg-input-access > option {
+	background-position: 0 0;
+}
+
 .file-photo {
 	margin-top: 15px;
 }
diff --git a/views/default/output/access.php b/views/default/output/access.php
new file mode 100644
index 0000000..fdb8fe1
--- /dev/null
+++ b/views/default/output/access.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Displays HTML for entity access levels.
+ * Requires an entity because some special logic for containers is used.
+ *
+ * @uses int $vars['entity'] - The entity whose access ID to display.
+ */
+
+//sort out the access level for display
+if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) {
+	$access_id = $vars['entity']->access_id;
+	$access_class = 'elgg-access';
+	$access_id_string = get_readable_access_level($access_id);
+	$access_id_string = htmlentities($access_id_string, ENT_QUOTES, 'UTF-8');
+
+	// if within a group or shared access collection display group name and open/closed membership status
+	// @todo have a better way to do this instead of checking against subtype / class.
+	$container = $vars['entity']->getContainerEntity();
+
+	if ($container && $container instanceof ElggGroup) {
+		// we decided to show that the item is in a group, rather than its actual access level
+		// not required. Group ACLs are prepended with "Group: " when written.
+		//$access_id_string = elgg_echo('groups:group') . $container->name;
+		$membership = $container->membership;
+
+		if ($membership == ACCESS_PUBLIC) {
+			$access_class .= ' elgg-access-group-open';
+		} else {
+			$access_class .= ' elgg-access-group-closed';
+		}
+	}
+
+	switch ($access_id) {
+		case ACCESS_PRIVATE:
+			$access_class .= ' elgg-access-private';
+			break;
+		case ACCESS_FRIENDS:
+			$access_class .= ' elgg-access-friends';
+			break;
+		case ACCESS_LOGGED_IN:
+			$access_class .= ' elgg-access-loggedin';
+			break;
+		case ACCESS_PUBLIC:
+			$access_class .= ' elgg-access-public';
+			break;
+		default:
+			$access_class .= ' elgg-access-group';
+	}
+
+	$help_text = elgg_echo('access:help');
+
+	echo "<span title=\"$help_text\" class=\"$access_class\">$access_id_string</span>";
+}
-- 
cgit v1.2.3