aboutsummaryrefslogtreecommitdiff
path: root/mod/profile
diff options
context:
space:
mode:
Diffstat (limited to 'mod/profile')
-rw-r--r--mod/profile/profile.js48
-rw-r--r--mod/profile/start.php4
-rw-r--r--mod/profile/views/default/profile/css.php29
-rw-r--r--mod/profile/views/default/profile/hoverover.php43
-rw-r--r--mod/profile/views/default/profile/icon.php9
-rw-r--r--mod/profile/views/default/profile/menu.php33
-rw-r--r--mod/profile/views/default/profile/metatags.php16
-rw-r--r--mod/profile/views/default/user/user.php2
8 files changed, 149 insertions, 35 deletions
diff --git a/mod/profile/profile.js b/mod/profile/profile.js
new file mode 100644
index 000000000..278793c27
--- /dev/null
+++ b/mod/profile/profile.js
@@ -0,0 +1,48 @@
+
+ /**
+ * Elgg profile javascript library
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Ben Werdmuller <ben@curverider.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ *
+ */
+
+function remove_user_menu() {
+
+ $("#user_menu").hover(function() {}, function () {
+ $("#user_menu").remove();
+ });
+
+};
+
+$(document).ready(function () {
+
+ $("a.icon").hover(function(e) {
+
+ var userdescription = this.rel;
+
+ var dwidth = $(document).width();
+
+ $("body").append("<div id='user_menu'>"+ userdescription + "</div>");
+
+ var top = e.pageY - 10;
+ var left = e.pageX - 10;
+
+ if ((left + 10 + $("#user_menu").width()) > (dwidth - 10)) {
+ left = dwidth - $("#user_menu").width() - 50;
+ }
+
+ $("#user_menu")
+ .css("top",(top) + "px")
+ .css("left",(left) + "px")
+ .fadeIn("medium");
+
+
+ remove_user_menu();
+
+ });
+
+}); \ No newline at end of file
diff --git a/mod/profile/start.php b/mod/profile/start.php
index 354abbd58..63b579784 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -56,6 +56,10 @@
register_page_handler('profile','profile_page_handler');
register_page_handler('icon','profile_icon_handler');
+ // Add Javascript reference to the page header
+ extend_view('metatags','profile/metatags');
+ extend_view('css','profile/css');
+
}
/**
diff --git a/mod/profile/views/default/profile/css.php b/mod/profile/views/default/profile/css.php
new file mode 100644
index 000000000..a4c839f6e
--- /dev/null
+++ b/mod/profile/views/default/profile/css.php
@@ -0,0 +1,29 @@
+<?php
+
+?>
+
+#user_menu {
+ position:absolute;
+ border:1px solid #333333;
+ background:#e4ecf5;
+ color:#333333;
+ padding:0px;
+ width: 200px;
+ display:none;
+}
+
+#user_menu p {
+ margin: 0px;
+ padding: 5px;
+ padding-top: 0px;
+}
+
+#user_menu p.user_menu_name {
+ background-color: #888;
+ padding-top: 5px;
+ margin-bottom: 5px;
+}
+
+#user_menu p.user_menu_name b {
+ color: #fff;
+} \ No newline at end of file
diff --git a/mod/profile/views/default/profile/hoverover.php b/mod/profile/views/default/profile/hoverover.php
new file mode 100644
index 000000000..c0b553f94
--- /dev/null
+++ b/mod/profile/views/default/profile/hoverover.php
@@ -0,0 +1,43 @@
+<?php
+
+ /**
+ * Elgg profile icon hover over
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Ben Werdmuller <ben@curverider.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
+ */
+
+?>
+
+ <p class="user_menu_name">
+ <b><?php echo $vars['entity']->name; ?></b>
+ </p>
+
+<?php
+
+ if (isloggedin()) {
+ if ($_SESSION['user']->getGUID() != $vars['entity']->getGUID()) {
+ if ($vars['entity']->isFriend()) {
+ echo "<p class=\"user_menu_removefriend\"><a href=\"{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}\">" . elgg_echo("friend:remove") . "</a></p>";
+ } else {
+ echo "<p><a href=\"{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}\">" . elgg_echo("friend:add") . "</a></p>";
+ }
+ }
+ }
+
+?>
+
+ <p class="user_menu_profile">
+ <a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo elgg_echo("profile"); ?></a>
+ </p>
+ <p class="user_menu_friends">
+ <a href="<?php echo $vars['url']; ?>pg/friends/bwerdmuller/"><?php echo elgg_echo("friends"); ?></a>
+ </p>
+ <p class="user_menu_friends_of">
+ <a href="<?php echo $vars['url']; ?>pg/friendsof/bwerdmuller/"><?php echo elgg_echo("friends:of"); ?></a>
+ </p> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/icon.php b/mod/profile/views/default/profile/icon.php
index 3e96e7d97..9221a7be8 100644
--- a/mod/profile/views/default/profile/icon.php
+++ b/mod/profile/views/default/profile/icon.php
@@ -36,7 +36,14 @@
} else {
$align = "";
}
+
+ // Get the hoverover menu
+ $hoverover = elgg_view('profile/hoverover',$vars);
+ $hoverover = htmlentities($hoverover);
+ $hoverover = str_replace("\n","",$hoverover);
+ $hoverover = str_replace("\r","",$hoverover);
+ $hoverover = str_replace("\t","",$hoverover);
?>
- <a href="<?php echo $vars['entity']->getURL(); ?>"><img src="<?php echo $vars['url']; ?>pg/icon/<?php echo $username; ?>/<?php echo $vars['size']; ?>/<?php echo $icontime; ?>.jpg" border="0" <?php echo $align; ?> title="<?php echo $name; ?>" <?php echo $vars['js']; ?> /></a> \ No newline at end of file
+ <a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" rel="<?php echo $hoverover; ?>"><img src="<?php echo $vars['url']; ?>pg/icon/<?php echo $username; ?>/<?php echo $vars['size']; ?>/<?php echo $icontime; ?>.jpg" border="0" <?php echo $align; ?> title="<?php echo $name; ?>" <?php echo $vars['js']; ?> /></a> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/menu.php b/mod/profile/views/default/profile/menu.php
deleted file mode 100644
index 463301398..000000000
--- a/mod/profile/views/default/profile/menu.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
- /**
- * Elgg profile menu
- *
- * @package ElggProfile
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Ben Werdmuller <ben@curverider.co.uk>
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- *
- * @uses $vars['entity'] The user entity
- */
-
- if (isloggedin() && $vars['entity']->getGUID() != $vars['user']->getGUID()) {
-
- if ($vars['entity']->isFriend()) {
-
- echo "<p><a href=\"{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}\">" . elgg_echo("friend:remove") . "</a></p>";
-
- } else {
-
- echo "<p><a href=\"{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}\">" . elgg_echo("friend:add") . "</a></p>";
-
- }
-
- echo "<p>&nbsp;</p>";
-
- }
-
-?>
- <p><a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username ?>/"><?php echo sprintf(elgg_echo("friends:owned"),$vars['entity']->name) ?></a></p>
- <p><a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username ?>/"><?php echo sprintf(elgg_echo("friends:of:owned"),$vars['entity']->name) ?></a></p> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/metatags.php b/mod/profile/views/default/profile/metatags.php
new file mode 100644
index 000000000..202105d94
--- /dev/null
+++ b/mod/profile/views/default/profile/metatags.php
@@ -0,0 +1,16 @@
+<?php
+
+ /**
+ * Adds metatags to load Javascript required for the profile
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Ben Werdmuller <ben@curverider.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ *
+ */
+
+?>
+
+ <script type="text/javascript" src="<?php echo $vars['url']; ?>mod/profile/profile.js" ></script> \ No newline at end of file
diff --git a/mod/profile/views/default/user/user.php b/mod/profile/views/default/user/user.php
index 345a8aabb..4a8b9ee0b 100644
--- a/mod/profile/views/default/user/user.php
+++ b/mod/profile/views/default/user/user.php
@@ -12,6 +12,6 @@
* @uses $vars['entity'] The user entity
*/
- echo elgg_view_layout("one_column",elgg_view("profile/userdetails",$vars),elgg_view("profile/menu",$vars));
+ echo elgg_view_layout("one_column",elgg_view("profile/userdetails",$vars));
?> \ No newline at end of file