]> gitweb.fluxo.info Git - lorea/saravea_theme.git/commitdiff
Added privacy icons.
authorSem <sembrestels@riseup.net>
Thu, 4 Oct 2012 20:00:29 +0000 (22:00 +0200)
committerSem <sembrestels@riseup.net>
Thu, 4 Oct 2012 20:00:29 +0000 (22:00 +0200)
_graphics/privacy.png [new file with mode: 0644]
views/default/n1_theme/css.php
views/default/output/access.php [new file with mode: 0644]

diff --git a/_graphics/privacy.png b/_graphics/privacy.png
new file mode 100644 (file)
index 0000000..4866921
Binary files /dev/null and b/_graphics/privacy.png differ
index 32267cb690a20047fefdacb6b4e7f8a69f6d5810..c6a94a8e2646b0b515f5d9f8b6022748c7274f20 100644 (file)
        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 (file)
index 0000000..fdb8fe1
--- /dev/null
@@ -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>";
+}