]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merged interface changes to profile in.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 4 Mar 2010 16:36:48 +0000 (16:36 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 4 Mar 2010 16:36:48 +0000 (16:36 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5284 36083f99-b078-4883-b0ff-0f9b5a30f544

43 files changed:
mod/profile/actions/cropicon.php
mod/profile/actions/deletedefaultprofileitem.php
mod/profile/actions/edit.php
mod/profile/actions/editdefault.php
mod/profile/actions/iconupload.php
mod/profile/actions/resetdefaultprofile.php
mod/profile/defaultprofile.php
mod/profile/edit.php
mod/profile/editicon.php
mod/profile/icon.php
mod/profile/icondirect.php
mod/profile/index.php
mod/profile/javascript.php
mod/profile/languages/en.php
mod/profile/profile_lib.php [new file with mode: 0644]
mod/profile/start.php
mod/profile/views/default/profile/admin_menu.php [new file with mode: 0755]
mod/profile/views/default/profile/css.php
mod/profile/views/default/profile/edit.php
mod/profile/views/default/profile/editdefaultprofile.php
mod/profile/views/default/profile/editicon.php
mod/profile/views/default/profile/gallery.php [deleted file]
mod/profile/views/default/profile/hoverover.php
mod/profile/views/default/profile/icon.php
mod/profile/views/default/profile/javascript.php
mod/profile/views/default/profile/listing.php
mod/profile/views/default/profile/menu/actions.php
mod/profile/views/default/profile/menu/adminlinks.php
mod/profile/views/default/profile/menu/adminwrapper.php
mod/profile/views/default/profile/menu/links.php
mod/profile/views/default/profile/menu/linksownpage.php
mod/profile/views/default/profile/metatags.php
mod/profile/views/default/profile/profile_contents/activity.php [new file with mode: 0755]
mod/profile/views/default/profile/profile_contents/details.php [new file with mode: 0755]
mod/profile/views/default/profile/profile_contents/friends.php [new file with mode: 0755]
mod/profile/views/default/profile/profile_contents/twitter.php [new file with mode: 0755]
mod/profile/views/default/profile/profile_contents/widgets.php [new file with mode: 0644]
mod/profile/views/default/profile/profile_navigation.php [new file with mode: 0755]
mod/profile/views/default/profile/profile_ownerblock.php [new file with mode: 0755]
mod/profile/views/default/profile/profilelinks.php [deleted file]
mod/profile/views/default/profile/userdetails.php [deleted file]
mod/profile/views/default/river/user/default/profileiconupdate.php
mod/profile/views/default/river/user/default/profileupdate.php

index f86799ccffab603f87754a965b32c2beffc90457..70b8e9288ad6ea9aacb55727ef854c406cf7114e 100644 (file)
@@ -1,80 +1,74 @@
 <?php
+/**
+ * Elgg profile plugin upload new user icon action
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       /**
-        * Elgg profile plugin upload new user icon action
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+gatekeeper();
 
-       gatekeeper();
+$profile_username = get_input('username');
+$profile_owner = get_user_by_username($profile_username);
 
-       $x1 = (int) get_input('x_1',0);
-       $y1 = (int) get_input('y_1',0);
-       $x2 = (int) get_input('x_2',0);
-       $y2 = (int) get_input('y_2',0);
+if (!$profile_owner || !($profile_owner instanceof ElggUser) || !$profile_owner->canEdit()) {
+       register_error(elgg_echo('profile:icon:fail'));
+       forward($_SERVER['HTTP_REFERER']);
+}
+
+$x1 = (int) get_input('x_1',0);
+$y1 = (int) get_input('y_1',0);
+$x2 = (int) get_input('x_2',0);
+$y2 = (int) get_input('y_2',0);
+
+$filehandler = new ElggFile();
+$filehandler->owner_guid = $profile_owner->getGUID();
+$filehandler->setFilename("profile/" . $profile_owner->username . "master" . ".jpg");
+$filename = $filehandler->getFilenameOnFilestore();
        
-       // username is set in form which ensures the page owner is set
-       $user = page_owner_entity();
+$topbar = get_resized_image_from_existing_file($filename, 16, 16, true, $x1, $y1, $x2, $y2);
+$tiny = get_resized_image_from_existing_file($filename, 25, 25, true, $x1, $y1, $x2, $y2);
+$small = get_resized_image_from_existing_file($filename, 40, 40, true, $x1, $y1, $x2, $y2);
+$medium = get_resized_image_from_existing_file($filename, 100, 100, true, $x1, $y1, $x2, $y2);
        
-       if (!$user || !$user->canEdit()) {
-               register_error(elgg_echo("profile:icon:noaccess"));
-               forward();
-       }
-               
+if ($small !== FALSE && $medium !== FALSE && $tiny !== FALSE) {
        $filehandler = new ElggFile();
-       $filehandler->owner_guid = $user->getGUID();
-       $filehandler->setFilename("profile/" . $user->username . "master" . ".jpg");
-       $filename = $filehandler->getFilenameOnFilestore();
-       
-       $topbar = get_resized_image_from_existing_file($filename,16,16, true, $x1, $y1, $x2, $y2);
-       $tiny = get_resized_image_from_existing_file($filename,25,25, true, $x1, $y1, $x2, $y2);
-       $small = get_resized_image_from_existing_file($filename,40,40, true, $x1, $y1, $x2, $y2);
-       $medium = get_resized_image_from_existing_file($filename,100,100, true, $x1, $y1, $x2, $y2);
+       $filehandler->owner_guid = $profile_owner->getGUID();
+       $filehandler->setFilename("profile/" .  $profile_owner->username . "medium.jpg");
+       $filehandler->open("write");
+       $filehandler->write($medium);
+       $filehandler->close();
+       $filehandler->setFilename("profile/" .  $profile_owner->username . "small.jpg");
+       $filehandler->open("write");
+       $filehandler->write($small);
+       $filehandler->close();
+       $filehandler->setFilename("profile/" .  $profile_owner->username . "tiny.jpg");
+       $filehandler->open("write");
+       $filehandler->write($tiny);
+       $filehandler->close();
+       $filehandler->setFilename("profile/" .  $profile_owner->username . "topbar.jpg");
+       $filehandler->open("write");
+       $filehandler->write($topbar);
+       $filehandler->close();
+
+       $profile_owner->x1 = $x1;
+       $profile_owner->x2 = $x2;
+       $profile_owner->y1 = $y1;
+       $profile_owner->y2 = $y2;
        
-       if ($small !== false
-                               && $medium !== false
-                               && $tiny !== false) {
-                       
-                               $filehandler = new ElggFile();
-                               $filehandler->owner_guid = $user->getGUID();
-                               $filehandler->setFilename("profile/" .  $user->username . "medium.jpg");
-                               $filehandler->open("write");
-                               $filehandler->write($medium);
-                               $filehandler->close();
-                               $filehandler->setFilename("profile/" .  $user->username . "small.jpg");
-                               $filehandler->open("write");
-                               $filehandler->write($small);
-                               $filehandler->close();
-                               $filehandler->setFilename("profile/" .  $user->username . "tiny.jpg");
-                               $filehandler->open("write");
-                               $filehandler->write($tiny);
-                               $filehandler->close();
-                               $filehandler->setFilename("profile/" .  $user->username . "topbar.jpg");
-                               $filehandler->open("write");
-                               $filehandler->write($topbar);
-                               $filehandler->close();
-                               
-                               $user->x1 = $x1;
-                               $user->x2 = $x2;
-                               $user->y1 = $y1;
-                               $user->y2 = $y2;
-                               
-                                $user->icontime = time();
-                               
-                               system_message(elgg_echo("profile:icon:uploaded"));
-                       
-                       } else {
-                               register_error(elgg_echo("profile:icon:notfound"));
-                       }
-               
-    //forward the user back to the upload page to crop
-    
-    $url = $vars['url'] . "pg/profile/{$user->username}/editicon/";
+       $profile_owner->icontime = time();
+
+       system_message(elgg_echo("profile:icon:uploaded"));
+} else {
+       register_error(elgg_echo("profile:icon:notfound"));
+}
                
-       if (isloggedin()) forward($url);
+//forward the user back to the upload page to crop
+$url = "{$vars['url']}pg/profile/{$profile_owner->username}/edit/icon";
 
-?>
+if (isloggedin()) {
+       forward($url);
+}
index 309816035b4509b76f2423f4ef27f13c93c9a5c1..b5b2eba84e1e6863cc6392b6dc84f60e3d37e86b 100644 (file)
@@ -1,25 +1,25 @@
 <?php
-       /**
-        * Elgg profile plugin edit default profile action removal
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-               
-       global $CONFIG;
+/**
+ * Elgg profile plugin edit default profile action removal
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+global $CONFIG;
+
+admin_gatekeeper();
        
-       admin_gatekeeper();
+$id = (int)get_input('id');
        
-       $id = (int)get_input('id');
-       
-       if ( ($id) && (set_plugin_setting("admin_defined_profile_$id", '', 'profile')) && 
-                       (set_plugin_setting("admin_defined_profile_type_$id", '', 'profile')))
-                       system_message(elgg_echo('profile:editdefault:delete:success'));
-               else
-                       register_error(elgg_echo('profile:editdefault:delete:fail'));
-       
-       forward($_SERVER['HTTP_REFERER']);
-?>
+if ( ($id) && (set_plugin_setting("admin_defined_profile_$id", '', 'profile')) && 
+       (set_plugin_setting("admin_defined_profile_type_$id", '', 'profile'))) {
+       system_message(elgg_echo('profile:editdefault:delete:success'));
+} else {
+       register_error(elgg_echo('profile:editdefault:delete:fail'));
+}
+
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index bc14cd6e6499cfb7753add1764bd7ecf8ab2cedf..4afe4cd472899c0e0ae469560bc5dda4f91cee1a 100644 (file)
 <?php
-
-       /**
-        * Elgg profile plugin edit action
-        *
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load configuration
-               global $CONFIG;
-
-               gatekeeper();
-
-       // Get profile fields
-               $input = array();
-               $accesslevel = get_input('accesslevel');
-               if (!is_array($accesslevel)) $accesslevel = array();
-
-               foreach($CONFIG->profile as $shortname => $valuetype) {
-                       // the decoding is a stop gag to prevent &amp;&amp; showing up in profile fields
-                       // because it is escaped on both input (get_input()) and output (view:output/text). see #561 and #1405.
-                       // must decode in utf8 or string corruption occurs. see #1567.
-                       $value = html_entity_decode(get_input($shortname), ENT_COMPAT, 'UTF-8');
-
-                       // limit to reasonable sizes.
-                       if ($valuetype != 'longtext' && elgg_strlen($value) > 250) {
-                               $error = sprintf(elgg_echo('profile:field_too_long'), elgg_echo("profile:{$shortname}"));
-                               register_error($error);
-                               forward($_SERVER['HTTP_REFERER']);
-                       }
-
-                       if ($valuetype == 'tags') {
-                               $value = string_to_tag_array($value);
+/**
+ * Elgg profile plugin edit action
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+global $CONFIG;
+gatekeeper();
+
+$profile_username = get_input('username');
+$profile_owner = get_user_by_username($profile_username);
+
+if (!$profile_owner || !$profile_owner->canEdit()) {
+       system_message(elgg_echo("profile:noaccess"));
+       forward($_SERVER['HTTP_REFERER']);
+}
+
+// grab the defined profile field names and their load the values from POST.
+// each field can have its own access, so sort that too.
+$input = array();
+$accesslevel = get_input('accesslevel');
+
+if (!is_array($accesslevel)) {
+       $accesslevel = array();
+}
+
+foreach($CONFIG->profile as $shortname => $valuetype) {
+       // the decoding is a stop gag to prevent &amp;&amp; showing up in profile fields
+       // because it is escaped on both input (get_input()) and output (view:output/text). see #561 and #1405.
+       // must decode in utf8 or string corruption occurs. see #1567.
+       $value = html_entity_decode(get_input($shortname), ENT_COMPAT, 'UTF-8');
+
+       // limit to reasonable sizes.
+       if ($valuetype != 'longtext' && elgg_strlen($value) > 250) {
+               $error = sprintf(elgg_echo('profile:field_too_long'), elgg_echo("profile:{$shortname}"));
+               register_error($error);
+               forward($_SERVER['HTTP_REFERER']);
+       }
+
+       if ($valuetype == 'tags') {
+               $value = string_to_tag_array($value);
+       }
+
+       $input[$shortname] = $value;
+}
+
+// display name is handled separately
+if ($name = strip_tags(get_input('name'))) {
+       if (elgg_strlen($name) > 50) {
+               register_error(elgg_echo('user:name:fail'));
+       } else {
+               $profile_owner->name = $name;
+               // @todo this is weird...giving two notifications?
+               if ($profile_owner->save()) {
+                       system_message(elgg_echo('user:name:success'));
+               } else {
+                       register_error(elgg_echo('user:name:fail'));
+               }
+       }
+}
+
+// go through custom fields
+if (sizeof($input) > 0) {
+       foreach($input as $shortname => $value) {
+               remove_metadata($profile_owner->guid, $shortname);
+               if (isset($accesslevel[$shortname])) {
+                       $access_id = (int) $accesslevel[$shortname];
+               } else {
+                       // this should never be executed since the access level should always be set
+                       $access_id = ACCESS_DEFAULT;
+               }
+               if (is_array($value)) {
+                       $i = 0;
+                       foreach($value as $interval) {
+                               $i++;
+                               $multiple = ($i > 1) ? TRUE : FALSE;
+                               create_metadata($profile_owner->guid, $shortname, $interval, 'text', $profile_owner->guid, $access_id, $multiple);
                        }
-
-                       $input[$shortname] = $value;
+               } else {
+                       create_metadata($profile_owner->getGUID(), $shortname, $value, 'text', $profile_owner->getGUID(), $access_id);
                }
+       }
 
-       // Get the page owner to see if the currently logged in user canEdit() the page owner.
-
-               $user = page_owner_entity();
-               if (!$user) {
-                       $user = $_SESSION['user'];
+       $profile_owner->save();
 
-                       // @todo this doesn't make sense...???
-                       set_page_owner($user->getGUID());
-               }
-               if ($user->canEdit()) {
-
-                       // Save stuff
-                       if (sizeof($input) > 0)
-                               foreach($input as $shortname => $value) {
-                                       //$user->$shortname = $value;
-                                       remove_metadata($user->guid, $shortname);
-                                       if (isset($accesslevel[$shortname])) {
-                                               $access_id = (int) $accesslevel[$shortname];
-                                       } else {
-                                               // this should never be executed since the access level should always be set
-                                               $access_id = ACCESS_PRIVATE;
-                                       }
-                                       if (is_array($value)) {
-                                               $i = 0;
-                                               foreach($value as $interval) {
-                                                       $i++;
-                                                       if ($i == 1) { $multiple = false; } else { $multiple = true; }
-                                                       create_metadata($user->guid, $shortname, $interval, 'text', $user->guid, $access_id, $multiple);
-                                               }
-                                       } else {
-                                               create_metadata($user->guid, $shortname, $value, 'text', $user->guid, $access_id);
-                                       }
-                               }
-                       $user->save();
-
-                       // Notify of profile update
-                       trigger_elgg_event('profileupdate',$user->type,$user);
-
-                       //add to river
-                       add_to_river('river/user/default/profileupdate','update',$_SESSION['user']->guid,$_SESSION['user']->guid,get_default_access($_SESSION['user']));
-
-                       system_message(elgg_echo("profile:saved"));
-
-                       // Forward to the user's profile
-                       forward($user->getUrl());
+       // Notify of profile update
+       trigger_elgg_event('profileupdate',$user->type,$user);
 
-               } else {
-       // If we can't, display an error
+       //add to river
+       add_to_river('river/user/default/profileupdate','update',$_SESSION['user']->guid,$_SESSION['user']->guid,get_default_access($_SESSION['user']));
 
-                       system_message(elgg_echo("profile:noaccess"));
-               }
+       system_message(elgg_echo("profile:saved"));
+}
 
-?>
+forward($profile_owner->getUrl());
\ No newline at end of file
index cf662e9b2d2f7f66f5dea9f54bc3f64025faae9d..7f5fe00049692cac14887d012dfb91303ad8c037 100644 (file)
@@ -1,39 +1,35 @@
 <?php
-
-       /**
-        * Elgg profile plugin edit default profile action
-        *
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load configuration
-       global $CONFIG;
-
-       admin_gatekeeper();
-
-       $label = sanitise_string(get_input('label'));
-       $type = sanitise_string(get_input('type'));
-
-       if (($label) && ($type))
-       {
-               $n = 0;
-               while (get_plugin_setting("admin_defined_profile_$n", 'profile')) {$n++;} // find free space
-
-               if ( (set_plugin_setting("admin_defined_profile_$n", $label, 'profile')) &&
-                       (set_plugin_setting("admin_defined_profile_type_$n", $type, 'profile'))) {
-                               set_plugin_setting('user_defined_fields', TRUE, 'profile');
-                               system_message(elgg_echo('profile:editdefault:success'));
-               } else {
-                       register_error(elgg_echo('profile:editdefault:fail'));
-               }
-
+/**
+ * Elgg profile plugin edit default profile action
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+global $CONFIG;
+admin_gatekeeper();
+
+$label = sanitise_string(get_input('label'));
+$type = sanitise_string(get_input('type'));
+
+if (($label) && ($type)){
+       // find next index for new field
+       $n = 0;
+       while (get_plugin_setting("admin_defined_profile_$n", 'profile')) {
+               $n++;
        }
-       else
+
+       if ( (set_plugin_setting("admin_defined_profile_$n", $label, 'profile')) && 
+               (set_plugin_setting("admin_defined_profile_type_$n", $type, 'profile'))) {
+               system_message(elgg_echo('profile:editdefault:success'));
+       } else {
                register_error(elgg_echo('profile:editdefault:fail'));
+       }
+} else {
+       register_error(elgg_echo('profile:editdefault:fail'));
+}
 
-       forward($_SERVER['HTTP_REFERER']);
-?>
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index f1d290694971cbff99b31076b39b055ff8a6fd34..a0cb24c3dca1c6b79ab81a7436d55d5c68235a06 100644 (file)
@@ -1,91 +1,68 @@
 <?php
+/**
+ * Elgg profile plugin upload new user icon action
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       /**
-        * Elgg profile plugin upload new user icon action
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+gatekeeper();
 
-       gatekeeper();
-       
-       $user = page_owner_entity();
-       if (!$user)
-               $user = $_SESSION['user'];
-               
-       // If we were given a correct icon
-               if (
-                               (isloggedin()) &&
-                               ($user) &&
-                               ($user->canEdit())
-                       ) {
-                               
-                               
-                               $topbar = get_resized_image_from_uploaded_file('profileicon',16,16, true);
-                               $tiny = get_resized_image_from_uploaded_file('profileicon',25,25, true);
-                               $small = get_resized_image_from_uploaded_file('profileicon',40,40, true);
-                               $medium = get_resized_image_from_uploaded_file('profileicon',100,100, true);
-                               $large = get_resized_image_from_uploaded_file('profileicon',200,200);
-                               $master = get_resized_image_from_uploaded_file('profileicon',550,550);
-                               
-                               if ($small !== false
-                                       && $medium !== false
-                                       && $large !== false
-                                       && $tiny !== false) {
-                               
-                                       $filehandler = new ElggFile();
-                                       $filehandler->owner_guid = $user->getGUID();
-                                       $filehandler->setFilename("profile/" . $user->username . "large.jpg");
-                                       $filehandler->open("write");
-                                       $filehandler->write($large);
-                                       $filehandler->close();
-                                       $filehandler->setFilename("profile/" . $user->username . "medium.jpg");
-                                       $filehandler->open("write");
-                                       $filehandler->write($medium);
-                                       $filehandler->close();
-                                       $filehandler->setFilename("profile/" . $user->username . "small.jpg");
-                                       $filehandler->open("write");
-                                       $filehandler->write($small);
-                                       $filehandler->close();
-                                       $filehandler->setFilename("profile/" . $user->username . "tiny.jpg");
-                                       $filehandler->open("write");
-                                       $filehandler->write($tiny);
-                                       $filehandler->close();
-                                       $filehandler->setFilename("profile/" . $user->username . "topbar.jpg");
-                                       $filehandler->open("write");
-                                       $filehandler->write($topbar);
-                                       $filehandler->close();
-                                       $filehandler->setFilename("profile/" . $user->username . "master.jpg");
-                                       $filehandler->open("write");
-                    $filehandler->write($master);
-                                       $filehandler->close();
-                                       
-                                       $user->icontime = time();
-                                       
-                                       system_message(elgg_echo("profile:icon:uploaded"));
-                                       
-                                       trigger_elgg_event('profileiconupdate',$user->type,$user);
-                                       
-                                       //add to river
-                                       add_to_river('river/user/default/profileiconupdate','update',$user->guid,$user->guid);
-                               
-                               } else {
-                                       system_message(elgg_echo("profile:icon:notfound"));                                     
-                               }
-                               
-                       } else {
-                               
-                               system_message(elgg_echo("profile:icon:notfound"));
-                               
-                       }
-                       
-           //forward the user back to the upload page to crop
-           
-           $url = "pg/profile/{$user->username}/editicon/";
-                       
-               if (isloggedin()) forward($url);
+$profile_username = get_input('username');
+$profile_owner = get_user_by_username($profile_username);
 
-?>
+if (!$profile_owner || !($profile_owner instanceof ElggUser) || !$profile_owner->canEdit()) {
+       register_error(elgg_echo('profile:icon:fail'));
+       forward($_SERVER['HTTP_REFERER']);
+}
+
+$profile_owner_guid = $profile_owner->getGUID();
+
+//@todo make this configurable?
+$icon_sizes = array(
+       'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE),
+       'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE),
+       'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE),
+       'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE),
+       'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE),
+       'master' => array('w'=>1600, 'h'=>1600, 'square'=>FALSE)
+);
+
+// get the images and save their file handlers into an array
+// so we can do clean up if one fails.
+$files = array();
+foreach ($icon_sizes as $name => $size_info) {
+       $resized = get_resized_image_from_uploaded_file('profileicon', $size_info['w'], $size_info['h'], $size_info['square']);
+
+       if ($resized) {
+               //@todo Make these actual entities.  See exts #348.
+               $file = new ElggFile();
+               $file->owner_guid = $profile_owner_guid;
+               $file->setFilename("profile/{$profile_username}{$name}.jpg");
+               $file->open('write');
+               $file->write($resized);
+               $file->close();
+               $files[] = $file;
+       } else {
+               // cleanup on fail
+               foreach ($files as $file) {
+                       $file->delete();
+               }
+
+               system_message(elgg_echo('profile:icon:notfound'));
+               forward($_SERVER['HTTP_REFERER']);
+       }
+}
+
+$profile_owner->icontime = time();
+if (trigger_elgg_event('profileiconupdate', $profile_owner->type, $profile_owner)) {
+       // pull this out into the river plugin.
+       //add_to_river('river/user/default/profileiconupdate','update',$user->guid,$user->guid);
+       system_message(elgg_echo("profile:icon:uploaded"));
+}
+
+//forward the user back to the upload page to crop
+forward($_SERVER['HTTP_REFERER']);
index 2100c95c2de349620f8f0d8a8ca5bd11d05f86c0..a6c90d4b77c92ba1194d99774c01b56bef24b251 100644 (file)
@@ -1,30 +1,27 @@
 <?php
-       /**
       * Elgg profile plugin edit default profile action
       *
       * @package ElggProfile
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Curverider Ltd <info@elgg.com>
       * @copyright Curverider Ltd 2008-2010
       * @link http://elgg.com/
       */
+/**
+ * Elgg profile plugin edit default profile action
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       // Load configuration
-       global $CONFIG;
+global $CONFIG;
+admin_gatekeeper();
 
-       admin_gatekeeper();
+$n = 0;
+while (get_plugin_setting("admin_defined_profile_$n", 'profile')) {
+       set_plugin_setting("admin_defined_profile_$n", '', 'profile');
+       set_plugin_setting("admin_defined_profile_type_$n", '', 'profile');
 
-       $n = 0;
-       while (get_plugin_setting("admin_defined_profile_$n", 'profile')) {
-               set_plugin_setting("admin_defined_profile_$n", '', 'profile');
-               set_plugin_setting("admin_defined_profile_type_$n", '', 'profile');
+       $n++;
+}
 
-               $n++;
-       }
+set_plugin_setting('user_defined_fields', FALSE, 'profile');
 
-       set_plugin_setting('user_defined_fields', FALSE, 'profile');
+system_message(elgg_echo('profile:defaultprofile:reset'));
 
-       system_message(elgg_echo('profile:defaultprofile:reset'));
-
-       forward($_SERVER['HTTP_REFERER']);
-?>
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
index 9272a736352b6a91d19905dbf9fba0b296a7e689..1e288458243cd8c5327c26c69743014bdf8602d2 100644 (file)
@@ -1,55 +1,49 @@
 <?php
-       /**
-        * Elgg profile index
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-       
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+/**
+ * Elgg profile index
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       admin_gatekeeper();
-       set_context('admin');
-       
-       $title = elgg_view_title(elgg_echo('profile:edit:default'));
-       $form = elgg_view('profile/editdefaultprofile');
-       
-       
-       set_context('search');
-       
-       
-       // List form elements
-       $n = 0;
-       $loaded_defaults = array();
-       $listing .= "<div class=\"contentWrapper\">";
-       while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile'))
-       {
-               $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile');
-               $listing .= elgg_view("profile/", array('value' => $translation));      
-               
-               $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';                                    
-       
-               $listing .= "<p class=\"{$even_odd}\"><b>$translation: </b>";
-               $listing .= elgg_view("output/{$type}",array('value' => " [$type]"));
-               $listing .= "</p>";
-               
-               $n++;
-       }
-       $listing .= "</div>";
-       
-       $listing .= "<div class=\"contentWrapper resetdefaultprofile\">" . elgg_view('input/form', 
-               array(
-                       'body' => elgg_view('input/submit', array('value' => elgg_echo('profile:resetdefault'))), 
-                       'action' => $CONFIG->wwwroot . 'action/profile/editdefault/reset'
-               )
-       ) . "</div>";
-       
-       set_context('admin');
-       
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+admin_gatekeeper();
+set_context('admin');
+
+$title = elgg_view_title(elgg_echo('profile:edit:default'));
+$form = elgg_view('profile/editdefaultprofile');
+
+set_context('search');
+
+
+// List form elements
+$n = 0;
+$loaded_defaults = array();
+while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile'))
+{
+       $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile');
+       $listing .= elgg_view("profile/", array('value' => $translation));      
+       
+       $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';                                    
+
+       $listing .= "<p class=\"{$even_odd}\"><b>$translation: </b>";
+       $listing .= elgg_view("output/{$type}",array('value' => " [$type]"));
+       $listing .= "</p>";
        
-       page_draw(elgg_echo('profile:edit:default'),elgg_view_layout("two_column_left_sidebar", '', $title . $form . $listing));
+       $n++;
+}
+
+$listing .= "<div class='default_profile_reset'>" . elgg_view('input/form', 
+       array(
+               'body' => elgg_view('input/submit', array('value' => elgg_echo('profile:resetdefault'))), 
+               'action' => $CONFIG->wwwroot . 'action/profile/editdefault/reset'
+       )
+) . "</div>";
+
+set_context('admin');
        
-?>
+page_draw(elgg_echo('profile:edit:default'),elgg_view_layout("one_column_with_sidebar", '', $title . $form . $listing));
\ No newline at end of file
index a11faf4f6c0f0cf8eb7e2480610aacc7b74e0962..313d144fea4226fea28d20119cd18ef412b06c7a 100644 (file)
@@ -1,44 +1,46 @@
 <?php
 
-       /**
       * Elgg profile editor
       
       * @package ElggProfile
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Curverider Ltd <info@elgg.com>
       * @copyright Curverider Ltd 2008-2010
       * @link http://elgg.com/
       */
-
-       // Get the Elgg engine
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-       // If we're not logged on, forward the user elsewhere
-       if (!isloggedin()) {
-               forward();
-       }
-       
-       // Get owner of profile - set in page handler
-       $user = page_owner_entity();
-       if (!$user) {
-               register_error(elgg_echo("profile:notfound"));
-               forward();
-       }
-
-       // check if logged in user can edit this profile
-       if (!$user->canEdit()) {
-               register_error(elgg_echo("profile:noaccess"));
-               forward();
-       }
-       
-       // Get edit form
-       $area2 = elgg_view_title(elgg_echo('profile:edit'));
-       $area2 .= elgg_view("profile/edit",array('entity' => $user)); 
-       
-       $area1 = "";
+/**
+ * Elgg profile editor
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+// Get the Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// If we're not logged on, forward the user elsewhere
+if (!isloggedin()) {
+       forward();
+}
+
+// Get owner of profile - set in page handler
+$user = page_owner_entity();
+if (!$user) {
+       register_error(elgg_echo("profile:notfound"));
+       forward();
+}
+
+// check if logged in user can edit this profile
+if (!$user->canEdit()) {
+       register_error(elgg_echo("profile:noaccess"));
+       forward();
+}
+
+// Get edit form
+$area2 = elgg_view_title(elgg_echo('profile:edit'));
+$area2 .= elgg_view("profile/edit",array('entity' => $user)); 
+
+$area1 = "";
        
-       // get the required canvas area
-       $body = elgg_view_layout("two_column_left_sidebar", $area1, $area2);
+set_context('profile_edit');
+
+// get the required canvas area
+$body = elgg_view_layout("one_column_with_sidebar", $area1, $area2);
        
-       // Draw the page
-       page_draw(elgg_echo("profile:edit"),$body);
+// Draw the page
+page_draw(elgg_echo("profile:edit"),$body);
index 97df6d56ec8c89bfd2089ef2e583e2f752816051..1c5c20d305200528498beca0d760693710bee4a3 100644 (file)
@@ -1,42 +1,43 @@
 <?php
+/**
+ * Elgg upload new profile icon
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       /**
-        * Elgg upload new profile icon
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+// Load the Elgg framework
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
 
-       // Load the Elgg framework
-       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-       
-       // Make sure we're logged in
-       if (!isloggedin()) {
-               forward();
-       }
+// Make sure we're logged in
+if (!isloggedin()) {
+       forward();
+}
 
-       // Get owner of profile - set in page handler
-       $user = page_owner_entity();
-       if (!$user) {
-               register_error(elgg_echo("profile:notfound"));
-               forward();
-       }
+// Get owner of profile - set in page handler
+$user = page_owner_entity();
+if (!$user) {
+       register_error(elgg_echo("profile:notfound"));
+       forward();
+}
 
-       // check if logged in user can edit this profile icon
-       if (!$user->canEdit()) {
-               register_error(elgg_echo("profile:icon:noaccess"));
-               forward();
-       }
-       
-       // set title
-       $area2 = elgg_view_title(elgg_echo('profile:createicon:header'));
-       $area2 .= elgg_view("profile/editicon", array('user' => $user));
-       
-       // Get the form and correct canvas area
-       $body = elgg_view_layout("two_column_left_sidebar", '', $area2);
+// check if logged in user can edit this profile icon
+if (!$user->canEdit()) {
+       register_error(elgg_echo("profile:icon:noaccess"));
+       forward();
+}
+
+// set title
+$area2 = elgg_view_title(elgg_echo('profile:createicon:header'));
+$area2 .= elgg_view("profile/edit_icon", array('user' => $user));
+
+set_context('profile_edit');
+
+// Get the form and correct canvas area
+$body = elgg_view_layout("one_column_with_sidebar", '', $area2);
        
-       // Draw the page
-       page_draw(elgg_echo("profile:editicon"), $body);
+// Draw the page
+page_draw(elgg_echo("profile:editicon"), $body);
index 802cc37568dbbd33c5d16f506c0024cf44b4a5ec..463eb3db53b3fce02c133a8f87737ee4aab02eef 100644 (file)
@@ -1,58 +1,52 @@
 <?php
+/**
+* Elgg profile icon
+* 
+* @package ElggProfile
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
 
-       /**
-        * Elgg profile icon
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load the Elgg framework
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-       // Get the owning user
-
-               $user = page_owner_entity(); // page_owner_entity();
-               $username = $user->username;
-               
-       // Get the size
-               $size = strtolower(get_input('size'));
-               if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
-                       $size = "medium";
-               
-       // Try and get the icon
-       
-               $filehandler = new ElggFile();
-               $filehandler->owner_guid = $user->getGUID();
-               $filehandler->setFilename("profile/" . $username . $size . ".jpg");
-               
-               $success = false;
-               if ($filehandler->open("read")) {
-                       if ($contents = $filehandler->read($filehandler->size())) {
-                               $success = true;
-                       } 
-               }
-               
-               if (!$success) {
-                       
-                       global $CONFIG;
-                       $path = elgg_view('icon/user/default/'.$size);
-                       header("Location: {$path}");
-                       exit;
-                       //$contents = @file_get_contents($CONFIG-pluginspath . "profile/graphics/default{$size}.jpg");
-                       
-               }
-               
-               header("Content-type: image/jpeg");
-               header('Expires: ' . date('r',time() + 864000));
-               header("Pragma: public");
-               header("Cache-Control: public");
-               header("Content-Length: " . strlen($contents));
-               $splitString = str_split($contents, 1024);
-               foreach($splitString as $chunk)
-                       echo $chunk;
-
-?>
\ No newline at end of file
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// Get the owning user
+$user = page_owner_entity();
+$username = $user->username;
+
+// Get the size
+$size = strtolower(get_input('size'));
+if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
+       $size = "medium";
+
+// Try and get the icon
+$filehandler = new ElggFile();
+$filehandler->owner_guid = $user->getGUID();
+$filehandler->setFilename("profile/" . $username . $size . ".jpg");
+
+$success = false;
+if ($filehandler->open("read")) {
+       if ($contents = $filehandler->read($filehandler->size())) {
+               $success = true;
+       } 
+}
+
+if (!$success) {
+       global $CONFIG;
+       $path = elgg_view('icon/user/default/'.$size);
+       header("Location: {$path}");
+       exit;
+}
+
+header("Content-type: image/jpeg");
+header('Expires: ' . date('r',time() + 864000));
+header("Pragma: public");
+header("Cache-Control: public");
+header("Content-Length: " . strlen($contents));
+
+$splitString = str_split($contents, 1024);
+
+foreach($splitString as $chunk) {
+       echo $chunk;
+}
\ No newline at end of file
index ec4227217f58b8508e13b9adaf8935f282bc2b36..a9aed2eea1560cf36cb8ce1623f81b134742e067 100644 (file)
 <?php
+/**
+ * Elgg profile icon
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+*/
 
-       /**
-        * Elgg profile icon
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php');
 
-       // Get DB settings, connect
-               require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php');
-
-               /**
-                * UTF safe str_split.
-                * This is only used here since we don't have access to the file store code.
-                * TODO: This is a horrible hack, so clean this up!
-                */
-               function __id_mb_str_split($string, $charset = 'UTF8')
-               {
-                       if (is_callable('mb_substr'))
-                       {
-                               $length = mb_strlen($string);
-                               $array = array();
-                               
-                               while ($length)
-                               {
-                                       $array[] = mb_substr($string, 0, 1, $charset);
-                                       $string = mb_substr($string, 1, $length, $charset);
-                                       
-                                       $length = mb_strlen($string);
-                               }
+/**
+ * UTF safe str_split.
+ * This is only used here since we don't have access to the file store code.
+ * TODO: This is a horrible hack, so clean this up!
+ */
+function __id_mb_str_split($string, $charset = 'UTF8'){
+       if (is_callable('mb_substr')){
+               $length = mb_strlen($string);
+               $array = array();
                                
-                               return $array;
-                       }
-                       else
-                               return str_split($string);
-                       
-                       return false;
+               while ($length){
+                       $array[] = mb_substr($string, 0, 1, $charset);
+                       $string = mb_substr($string, 1, $length, $charset);
+                       $length = mb_strlen($string);
                }
                
-               global $CONFIG;
+               return $array;
+       } else {
+               return str_split($string);
+       }
                        
-               $contents = '';
+       return FALSE;
+}
                
-               if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass, true)) {
-
-                       
-                       $username = $_GET['username'];
-                       //$username = preg_replace('/[^A-Za-z0-9\_\-]/i','',$username);
-                       $blacklist = '/[' .
-                       '\x{0080}-\x{009f}' . # iso-8859-1 control chars
-                       '\x{00a0}' .          # non-breaking space
-                       '\x{2000}-\x{200f}' . # various whitespace
-                       '\x{2028}-\x{202f}' . # breaks and control chars
-                       '\x{3000}' .          # ideographic space
-                       '\x{e000}-\x{f8ff}' . # private use
-                       ']/u';
-                       if (
-                               preg_match($blacklist, $username) ||    
-
-                               (strpos($username, '/')!==false) ||
-                               (strpos($username, '\\')!==false) ||
-                               (strpos($username, '"')!==false) ||
-                               (strpos($username, '\'')!==false) ||
-                               (strpos($username, '*')!==false) ||
-                               (strpos($username, '&')!==false) ||
-                               (strpos($username, ' ')!==false)
-                       ) exit;
+global $CONFIG;
+$contents = '';
+               
+if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass, true)) {
+       $username = $_GET['username'];
+       //$username = preg_replace('/[^A-Za-z0-9\_\-]/i','',$username);
+       $blacklist = '/[' .
+       '\x{0080}-\x{009f}' . # iso-8859-1 control chars
+       '\x{00a0}' .          # non-breaking space
+       '\x{2000}-\x{200f}' . # various whitespace
+       '\x{2028}-\x{202f}' . # breaks and control chars
+       '\x{3000}' .          # ideographic space
+       '\x{e000}-\x{f8ff}' . # private use
+       ']/u';
+       if (
+               preg_match($blacklist, $username) ||    
+               (strpos($username, '/')!==false) ||
+               (strpos($username, '\\')!==false) ||
+               (strpos($username, '"')!==false) ||
+               (strpos($username, '\'')!==false) ||
+               (strpos($username, '*')!==false) ||
+               (strpos($username, '&')!==false) ||
+               (strpos($username, ' ')!==false)
+       ) exit;
                        
-                       $userarray = __id_mb_str_split($username);
+       $userarray = __id_mb_str_split($username);
                                
-                       $matrix = '';
-                       $length = 5;
-                       if (sizeof($userarray) < $length) $length = sizeof($userarray);
-                       for ($n = 0; $n < $length; $n++) {
-                               $matrix .= $userarray[$n] . "/";
-                       }       
+       $matrix = '';
+       $length = 5;
+       if (sizeof($userarray) < $length) $length = sizeof($userarray);
+       for ($n = 0; $n < $length; $n++) {
+               $matrix .= $userarray[$n] . "/";
+       }       
                
-               // Get the size
-                       $size = strtolower($_GET['size']);
-                       if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
-                               $size = "medium";
+       // Get the size
+       $size = strtolower($_GET['size']);
+       if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
+               $size = "medium";
                        
-               // Try and get the icon
-                       if (@mysql_select_db($CONFIG->dbname,$mysql_dblink)) {
-                               // get dataroot and simplecache_enabled in one select for efficiency
-                               if ($result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name in ('dataroot','simplecache_enabled')",$mysql_dblink)) {
-                                       $simplecache_enabled = true;
-                                       $row = mysql_fetch_object($result);
-                                       while ($row) {
-                                               if ($row->name == 'dataroot') {
-                                                       $dataroot = $row->value;
-                                               } else if ($row->name == 'simplecache_enabled') {
-                                                       $simplecache_enabled = $row->value;
-                                               }
-                                               $row = mysql_fetch_object($result);
-                                       }
+       // Try and get the icon
+       if (@mysql_select_db($CONFIG->dbname,$mysql_dblink)) {
+               // get dataroot and simplecache_enabled in one select for efficiency
+               if ($result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name in ('dataroot','simplecache_enabled')",$mysql_dblink)) {
+                       $simplecache_enabled = true;
+                       $row = mysql_fetch_object($result);
+                       while ($row) {
+                               if ($row->name == 'dataroot') {
+                                       $dataroot = $row->value;
+                               } else if ($row->name == 'simplecache_enabled') {
+                                       $simplecache_enabled = $row->value;
                                }
+                               $row = mysql_fetch_object($result);
                        }
                }
-               //@todo forcing through the framework to ensure the matrix
-               // is created the same way.
-               //if ($simplecache_enabled) {
-               if (false) {
-                       $filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg";
-                       $contents = @file_get_contents($filename);
-                       if (empty($contents)) {                 
-                               global $viewinput;
-                               $viewinput['view'] = 'icon/user/default/'.$size;
-                               ob_start();
-                               include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php');
-                               $loc = ob_get_clean();
-                               header('Location: ' . $loc);
-                               exit;
-                               //$contents = @file_get_contents(dirname(__FILE__) . "/graphics/default{$size}.jpg");
-                       }       else {          
-                               header("Content-type: image/jpeg");
-                               header('Expires: ' . date('r',time() + 864000));
-                               header("Pragma: public");
-                               header("Cache-Control: public");
-                               header("Content-Length: " . strlen($contents));
-                               $splitString = str_split($contents, 1024);
-                               foreach($splitString as $chunk)
-                                       echo $chunk;
-                       }
-               } else {
-                               mysql_close($mysql_dblink);
-                               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-                               set_input('username',$username);
-                               set_input('size',$size);
-                               require_once(dirname(__FILE__).'/icon.php');
+       }
+}
+       //@todo forcing through the framework to ensure the matrix
+       // is created the same way.
+       //if ($simplecache_enabled) {
+       if (false) {
+               $filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg";
+               $contents = @file_get_contents($filename);
+               if (empty($contents)) {                 
+                       global $viewinput;
+                       $viewinput['view'] = 'icon/user/default/'.$size;
+                       ob_start();
+                       include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php');
+                       $loc = ob_get_clean();
+                       header('Location: ' . $loc);
+                       exit;
+                       //$contents = @file_get_contents(dirname(__FILE__) . "/graphics/default{$size}.jpg");
+               }       else {          
+                       header("Content-type: image/jpeg");
+                       header('Expires: ' . date('r',time() + 864000));
+                       header("Pragma: public");
+                       header("Cache-Control: public");
+                       header("Content-Length: " . strlen($contents));
+                       $splitString = str_split($contents, 1024);
+                       foreach($splitString as $chunk)
+                               echo $chunk;
                }
-?>
+       } else {
+                       mysql_close($mysql_dblink);
+                       require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+                       set_input('username',$username);
+                       set_input('size',$size);
+                       require_once(dirname(__FILE__).'/icon.php');
+       }
\ No newline at end of file
index ae67dd566bdffa3bfd72b5ea3e4c9e529b277e53..8c8d72d2436c04e4ad85232b3a4a1fbc6a43d7a1 100644 (file)
@@ -1,41 +1,60 @@
 <?php
+/**
+ * Elgg profile index
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       /**
-        * Elgg profile index
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
 
-       // Get the Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+$username = get_input('username');
+$option = get_input('option', 'activity');
+$body = '';
 
-       // Get the username
-               $username = get_input('username');
-               
-               $body = "";
-               
-       // Try and get the user from the username and set the page body accordingly
-               if ($user = get_user_by_username($username)) {
-                       
-                       if ($user->isBanned() && !isadminloggedin()) {
-                               forward(); exit;
-                       }
-                       $body = elgg_view_entity($user,true);
-                       $title = $user->name;
+// Try and get the user from the username and set the page body accordingly
+if ($user = get_user_by_username($username)) {
+       if ($user->isBanned() && !isadminloggedin()) {
+               forward(); exit;
+       }
+       $body = elgg_view('profile/profile_navigation', array("option" => $option,"entity" => $user));
+       switch($option){
+               case 'activity':
+                       $body .= elgg_view('profile/profile_contents/userdetails', array("entity" => $user));
+               break;
 
-                       $body = elgg_view_layout('widgets',$body);
-                       
-               } else {
-                       
-                       $body = elgg_echo("profile:notfound");
-                       $title = elgg_echo("profile");
-                       
-               }
+               case 'widgets':
+                       $body .= elgg_view_layout('widgets');
+               break;
 
-               page_draw($title, $body);
-               
-?>
\ No newline at end of file
+               case 'friends':
+                       $body .= elgg_view('profile/profile_contents/friends', array("entity" => $user));
+               break;
+               case 'extend':
+                       $body .= elgg_view('profile/profile_contents/extend', array("entity" => $user));
+               break;
+
+               case 'twitter':
+                       $body .= elgg_view('profile/profile_contents/twitter', array("entity" => $user));
+               break;
+
+               case 'default':
+                       $body .= elgg_view('profile/profile_contents/userdetails', array("entity" => $user));
+               break;
+       }
+       //$body .= elgg_view_entity($user,true);
+       $title = $user->name;
+       //$body .= elgg_view_layout('widgets');
+} else {
+       $body = elgg_echo("profile:notfound");
+       $title = elgg_echo("profile");
+}
+if ($option == 'widgets') {
+       //page_draw_widgets($title, $body, $sidebar="");
+} else {
+       $body = elgg_view_layout("one_column", $body);
+       page_draw($title, $body);
+}
\ No newline at end of file
index c2c9f821724a303796ddfb08e2287738c3111c96..62a934c150fa276442678abc372afe61f379b3a3 100644 (file)
@@ -1,22 +1,19 @@
 <?php
+/**
+ * Elgg profile JS
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       /**
-        * Elgg profile JS
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+// Get engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
 
-       // Get engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-               header("Content-type: text/javascript");
-               header('Expires: ' . date('r',time() + 864000));
-               header("Pragma: public");
-               header("Cache-Control: public");
-               echo elgg_view('profile/javascript');
-
-?>
\ No newline at end of file
+header("Content-type: text/javascript");
+header('Expires: ' . date('r',time() + 864000));
+header("Pragma: public");
+header("Cache-Control: public");
+echo elgg_view('profile/javascript');
\ No newline at end of file
index 7a9ec3f9d131f92092d1eaa4d0f32cce26b13931..90f49ca0a92b50590a947c85f002d825d206fcc2 100644 (file)
@@ -1,93 +1,94 @@
 <?php
-       /**
-        * Elgg profile plugin language pack
-        *
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       $english = array(
-
-       /**
-        * Profile
-        */
-
-               'profile' => "Profile",
-               'profile:edit:default' => 'Replace profile fields',
-               'profile:preview' => 'Preview',
-
-       /**
-        * Profile menu items and titles
-        */
-
-               'profile:yours' => "Your profile",
-               'profile:user' => "%s's profile",
-
-               'profile:edit' => "Edit profile",
-               'profile:profilepictureinstructions' => "The profile picture is the image that's displayed on your profile page. <br /> You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)",
-               'profile:icon' => "Profile picture",
-               'profile:createicon' => "Create your avatar",
-               'profile:currentavatar' => "Current avatar",
-               'profile:createicon:header' => "Profile picture",
-               'profile:profilepicturecroppingtool' => "Profile picture cropping tool",
-               'profile:createicon:instructions' => "Click and drag a square below to match how you want your picture cropped.  A preview of your cropped picture will appear in the box on the right.  When you are happy with the preview, click 'Create your avatar'. This cropped image will be used throughout the site as your avatar. ",
-
-               'profile:editdetails' => "Edit details",
-               'profile:editicon' => "Edit profile icon",
-
-               'profile:aboutme' => "About me",
-               'profile:description' => "About me",
-               'profile:briefdescription' => "Brief description",
-               'profile:location' => "Location",
-               'profile:skills' => "Skills",
-               'profile:interests' => "Interests",
-               'profile:contactemail' => "Contact email",
-               'profile:phone' => "Telephone",
-               'profile:mobile' => "Mobile phone",
-               'profile:website' => "Website",
-
-               'profile:banned' => 'This user account has been suspended.',
-               'profile:deleteduser' => 'Deleted user',
-
-               'profile:river:update' => "%s updated their profile",
-               'profile:river:iconupdate' => "%s updated their profile icon",
-
-               'profile:label' => "Profile label",
-               'profile:type' => "Profile type",
-
-               'profile:editdefault:fail' => 'Default profile could not be saved',
-               'profile:editdefault:success' => 'Item successfully added to default profile',
-
-
-               'profile:editdefault:delete:fail' => 'Removed default profile item field failed',
-               'profile:editdefault:delete:success' => 'Default profile item deleted!',
-
-               'profile:defaultprofile:reset' => 'Default system profile reset',
-
-               'profile:resetdefault' => 'Reset default profile',
-               'profile:explainchangefields' => 'You can replace the existing profile fields with your own using the form below. First you give the new profile field a label, for example, \'Favourite team\'. Next you need to select the field type, for example, tags, url, text and so on. At any time you can revert back to the default profile set up.',
-
-
-       /**
-        * Profile status messages
-        */
-
-               'profile:saved' => "Your profile was successfully saved.",
-               'profile:icon:uploaded' => "Your profile picture was successfully uploaded.",
-
-       /**
-        * Profile error messages
-        */
-
-               'profile:noaccess' => "You do not have permission to edit this profile.",
-               'profile:notfound' => "Sorry, we could not find the specified profile.",
-               'profile:icon:notfound' => "Sorry, there was a problem uploading your profile picture.",
-               'profile:icon:noaccess' => 'You cannot change this profile icon',
-               'profile:field_too_long' => 'Cannot save your profile information because the "%s" section is too long.',
-
-       );
-
-       add_translation("en",$english);
\ No newline at end of file
+/**
+ * Elgg profile plugin language pack
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+$english = array(
+
+/**
+ * Profile
+ */
+
+       'profile' => "Profile",
+       'profile:edit:default' => 'Replace profile fields',
+       'profile:preview' => 'Preview',
+
+/**
+ * Profile menu items and titles
+ */
+
+       'profile:yours' => "My profile",
+       'profile:user' => "%s's profile",
+
+       'profile:edit' => "Edit profile",
+       'profile:profilepictureinstructions' => "The profile picture is the image that's displayed on your profile page. <br /> You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)",
+       'profile:icon' => "Profile picture",
+       'profile:createicon' => "Create your avatar",
+       'profile:currentavatar' => "Current avatar",
+       'profile:createicon:header' => "Profile picture",
+       'profile:profilepicturecroppingtool' => "Profile picture cropping tool",
+       'profile:createicon:instructions' => "Click and drag a square below to match how you want your picture cropped.  A preview of your cropped picture will appear in the box on the right.  When you are happy with the preview, click 'Create your avatar'. This cropped image will be used throughout the site as your avatar. ",
+
+       'profile:editdetails' => "Edit details",
+       'profile:editicon' => "Edit profile icon",
+
+       'profile:aboutme' => "About me",
+       'profile:description' => "About me",
+       'profile:briefdescription' => "Brief description",
+       'profile:location' => "Location",
+       'profile:skills' => "Skills",
+       'profile:interests' => "Interests",
+       'profile:contactemail' => "Contact email",
+       'profile:phone' => "Telephone",
+       'profile:mobile' => "Mobile phone",
+       'profile:website' => "Website",
+
+       'profile:banned' => 'This user account has been suspended.',
+       'profile:deleteduser' => 'Deleted user',
+
+       'profile:river:update' => "%s updated their profile",
+       'profile:river:iconupdate' => "%s updated their profile icon",
+
+       'profile:label' => "Profile label",
+       'profile:type' => "Profile type",
+       'profile:twitter' => "Twitter username",
+       'twitter:visit' => "Visit this Twitter account",
+       'profile:editdefault:fail' => 'Default profile could not be saved',
+       'profile:editdefault:success' => 'Item successfully added to default profile',
+
+
+       'profile:editdefault:delete:fail' => 'Removed default profile item field failed',
+       'profile:editdefault:delete:success' => 'Default profile item deleted!',
+
+       'profile:defaultprofile:reset' => 'Default system profile reset',
+
+       'profile:resetdefault' => 'Reset default profile',
+       'profile:explainchangefields' => 'You can replace the existing profile fields with your own using the form below. First you give the new profile field a label, for example, \'Favourite team\'. Next you need to select the field type, for example, tags, url, text and so on. At any time you can revert back to the default profile set up.',
+
+
+/**
+ * Profile status messages
+ */
+
+       'profile:saved' => "Your profile was successfully saved.",
+       'profile:icon:uploaded' => "Your profile picture was successfully uploaded.",
+
+/**
+ * Profile error messages
+ */
+
+       'profile:noaccess' => "You do not have permission to edit this profile.",
+       'profile:notfound' => "Sorry, we could not find the specified profile.",
+       'profile:icon:notfound' => "Sorry, there was a problem uploading your profile picture.",
+       'profile:icon:noaccess' => 'You cannot change this profile icon',
+       'profile:field_too_long' => 'Cannot save your profile information because the "%s" section is too long.',
+
+);
+
+add_translation('en', $english);
\ No newline at end of file
diff --git a/mod/profile/profile_lib.php b/mod/profile/profile_lib.php
new file mode 100644 (file)
index 0000000..176c6e4
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Elgg profile index
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+/**
+ * Returns the html for a user profile.
+ *
+ * @param string $username The username of the profile to display
+ * @param string $section Which section is currently selected.
+ *
+ * return mixed FALSE or html for the profile.
+ */
+function profile_get_user_profile_html($user, $section = 'activity') {
+       $body = elgg_view('profile/profile_navigation', array('section' => $section, 'entity' => $user));
+       $view_options = array('entity' => $user);
+
+       switch($section){
+               case 'widgets':
+                       $body .= elgg_view_layout('widgets', $view_options);
+                       break;
+
+               case 'friends':
+                       $body .= elgg_view('profile/profile_contents/friends', $view_options);
+                       break;
+
+               case 'twitter':
+                       $body .= elgg_view('profile/profile_contents/twitter', $view_options);
+                       break;
+
+               case 'details':
+                       $body .= elgg_view('profile/profile_contents/details', $view_options);
+                       break;
+
+               default:
+               case 'activity':
+                       $body .= elgg_view('profile/profile_contents/activity', $view_options);
+                       break;
+       }
+
+       return $body;
+}
+
+/**
+ * Dispatch the html for the edit section
+ *
+ * @param unknown_type $user
+ * @param unknown_type $page
+ * @return string
+ */
+function profile_get_user_edit_content($user, $page) {
+       $section = (isset($page[2])) ? $page[2] : 'details';
+
+       switch ($section) {
+               case 'icon':
+                       $content = elgg_view_title(elgg_echo('profile:edit'));
+                       $content .= elgg_view("profile/editicon", array('entity' => $user));
+                       break;
+               default:
+               case 'details':
+                       $content = elgg_view_title(elgg_echo('profile:edit'));
+                       $content .= elgg_view("profile/edit", array('entity' => $user));
+                       break;
+       }
+
+       return $content;
+}
\ No newline at end of file
index 168d0b0139a069850d854cca7bad428de6174697..2fef3f4d21b6fd7d082656b44231458f8b1c4303 100644 (file)
 <?php
-
-       /**
-        * Elgg profile plugin
-        *
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       /**
-        * Profile init function; sets up the profile functions
-        *
-        */
-               function profile_init() {
-
-                       // Get config
-                               global $CONFIG;
-
-                       // Register a URL handler for users - this means that profile_url()
-                       // will dictate the URL for all ElggUser objects
-                               register_entity_url_handler('profile_url','user','all');
-
-                       // Metadata on users needs to be independent
-                               register_metadata_as_independent('user');
-
-                               elgg_view_register_simplecache('icon/user/default/tiny');
-                               elgg_view_register_simplecache('icon/user/default/topbar');
-                               elgg_view_register_simplecache('icon/user/default/small');
-                               elgg_view_register_simplecache('icon/user/default/medium');
-                               elgg_view_register_simplecache('icon/user/default/large');
-                               elgg_view_register_simplecache('icon/user/default/master');
-
-                       // For now, we'll hard code the profile items as follows:
-                       // TODO make this user configurable
-
-
-
-                               /*$CONFIG->profile = array(
-
-                                       // Language short codes must be of the form "profile:key"
-                                       // where key is the array key below
-                                       'description' => 'longtext',
-                                       'briefdescription' => 'text',
-                                       'location' => 'tags',
-                                       'interests' => 'tags',
-                                       'skills' => 'tags',
-                                       'contactemail' => 'email',
-                                       'phone' => 'text',
-                                       'mobile' => 'text',
-                                       'website' => 'url',
-
-                               );*/
-
-                       // Register a page handler, so we can have nice URLs
-                               register_page_handler('profile','profile_page_handler');
-                               register_page_handler('defaultprofile','profileedit_page_handler');
-                               register_page_handler('icon','profile_icon_handler');
-                               register_page_handler('iconjs','profile_iconjs_handler');
-
-                       // Add Javascript reference to the page header
-                               elgg_extend_view('metatags','profile/metatags');
-                               elgg_extend_view('css','profile/css');
-                               elgg_extend_view('js/initialise_elgg','profile/javascript');
-                               if (get_context() == "profile") {
-                                       elgg_extend_view('canvas_header/submenu','profile/submenu');
-                               }
-
-
-
-                       // Extend context menu with admin links
-                       if (isadminloggedin())
-                       {
-                                       elgg_extend_view('profile/menu/links','profile/menu/adminwrapper',10000);
-                       }
-
-                       // Now override icons
-                       register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
-
+/**
+ * Elgg profile plugin
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+/**
+ * Profile init function; sets up the profile functions
+ *
+ */
+function profile_init() {
+       global $CONFIG;
+
+       require_once 'profile_lib.php';
+
+       // Register a URL handler for users - this means that profile_url()
+       // will dictate the URL for all ElggUser objects
+       register_entity_url_handler('profile_url', 'user', 'all');
+
+       // Set up the menu for logged-in users
+       if (isloggedin()) {
+               add_menu(elgg_echo('profile:yours'), $_SESSION['user']->getURL() . '/extend');
+       }
+
+       // Metadata on users needs to be independent
+       register_metadata_as_independent('user');
+
+       elgg_view_register_simplecache('icon/user/default/tiny');
+       elgg_view_register_simplecache('icon/user/default/topbar');
+       elgg_view_register_simplecache('icon/user/default/small');
+       elgg_view_register_simplecache('icon/user/default/medium');
+       elgg_view_register_simplecache('icon/user/default/large');
+       elgg_view_register_simplecache('icon/user/default/master');
+
+       // Register a page handler, so we can have nice URLs
+       register_page_handler('profile', 'profile_page_handler');
+       register_page_handler('defaultprofile', 'profileedit_page_handler');
+       register_page_handler('icon', 'profile_icon_handler');
+       register_page_handler('iconjs', 'profile_iconjs_handler');
+
+       // Add Javascript reference to the page header
+       elgg_extend_view('metatags', 'profile/metatags');
+       elgg_extend_view('css', 'profile/css');
+       elgg_extend_view('js/initialise_elgg', 'profile/javascript');
+
+       if (get_context() == 'profile') {
+               elgg_extend_view('canvas_header/submenu', 'profile/submenu');
+       }
+
+       // Extend context menu with admin links
+       if (isadminloggedin()){
+               elgg_extend_view('profile/menu/links', 'profile/menu/adminwrapper', 10000);
+       }
+
+       // Now override icons
+       register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
+
+}
+
+/**
+ * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
+ * add and delete fields.
+ *
+ * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all
+ * other plugins have initialised.
+ */
+function profile_fields_setup() {
+       global $CONFIG;
+
+       $profile_defaults = array (
+               'description' => 'longtext',
+               'briefdescription' => 'text',
+               'location' => 'tags',
+               'interests' => 'tags',
+               'skills' => 'tags',
+               'contactemail' => 'email',
+               'phone' => 'text',
+               'mobile' => 'text',
+               'website' => 'url',
+               'twitter' => 'text'
+       );
+
+       // TODO: Have an admin interface for this
+       $n = 0;
+       $loaded_defaults = array();
+       while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile')){
+               // Add a translation
+               add_translation(get_current_language(), array("profile:admin_defined_profile_$n" => $translation));
+
+               // Detect type
+               $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile');
+               if (!$type) $type = 'text';
+
+               // Set array
+               $loaded_defaults["admin_defined_profile_$n"] = $type;
+
+               $n++;
+       }
+       if (count($loaded_defaults)) {
+               $CONFIG->profile_using_custom = true;
+               $profile_defaults = $loaded_defaults;
+       }
+
+       $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults);
+
+       // register any tag metadata names
+       foreach ($CONFIG->profile as $name => $type) {
+               if ($type == 'tags') {
+                       elgg_register_tag_metadata_name($name);
+                       // register a tag name translation
+                       add_translation(get_current_language(), array("tag_names:$name" => elgg_echo("profile:$name")));
                }
-
-       /**
-        * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
-        * add and delete fields.
-        *
-        * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all
-        * other plugins have initialised.
-        */
-               function profile_fields_setup()
-               {
-                       global $CONFIG;
-
-                       $profile_defaults = array (
-                               'description' => 'longtext',
-                               'briefdescription' => 'text',
-                               'location' => 'tags',
-                               'interests' => 'tags',
-                               'skills' => 'tags',
-                               'contactemail' => 'email',
-                               'phone' => 'text',
-                               'mobile' => 'text',
-                               'website' => 'url',
-                       );
-
-                       // TODO: Have an admin interface for this
-
-                       $n = 0;
-                       $loaded_defaults = array();
-                       while ($translation = get_plugin_setting("admin_defined_profile_$n", 'profile'))
-                       {
-                               // Add a translation
-                               add_translation(get_current_language(), array("profile:admin_defined_profile_$n" => $translation));
-
-                               // Detect type
-                               $type = get_plugin_setting("admin_defined_profile_type_$n", 'profile');
-                               if (!$type) $type = 'text';
-
-                               // Set array
-                               $loaded_defaults["admin_defined_profile_$n"] = $type;
-
-                               $n++;
-                       }
-                       if (count($loaded_defaults)) {
-                               $CONFIG->profile_using_custom = true;
-                               $profile_defaults = $loaded_defaults;
-                       }
-
-                       $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults);
-
-                       // register any tag metadata names
-                       foreach ($CONFIG->profile as $name => $type) {
-                               if ($type == 'tags') {
-                                       elgg_register_tag_metadata_name($name);
-                                       // register a tag name translation
-                                       add_translation(get_current_language(), array("tag_names:$name" => elgg_echo("profile:$name")));
-                               }
-                       }
+       }
+}
+
+/**
+ * Profile page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+function profile_page_handler($page) {
+       global $CONFIG;
+
+       $username = $action = NULL;
+
+       // short circuit if invalid or banned username
+       if (isset($page[0])) {
+               $username = $page[0];
+               $user = get_user_by_username($username);
+
+               if (!$user || ($user->isBanned() && !isadminloggedin())) {
+                       return elgg_echo('profile:notfound');
+               } else {
+                       set_input('username', $page[0]);
                }
+       }
 
-       /**
-        * Profile page handler
-        *
-        * @param array $page Array of page elements, forwarded by the page handling mechanism
-        */
-               function profile_page_handler($page) {
+       if (isset($page[1])) {
+               $action = $page[1];
+       }
 
-                       global $CONFIG;
-
-                       // The username should be the file we're getting
-                       if (isset($page[0])) {
-                               set_input('username',$page[0]);
+       switch ($action) {
+               case 'edit':
+                       if (!$user || !$user->canEdit()) {
+                               register_error(elgg_echo("profile:noaccess"));
+                               forward();
                        }
-                       // Any sub pages?
-                       if (isset($page[1])) {
 
-                               switch ($page[1])
-                               {
-                                       case 'edit' : include($CONFIG->pluginspath . "profile/edit.php"); break;
-                                       case 'editicon' : include($CONFIG->pluginspath . "profile/editicon.php"); break;
+                       $content = profile_get_user_edit_content($user, $page);
+                       break;
 
-                               }
-                       }
-                       else
-                       {
-                               // Include the standard profile index
-                               include($CONFIG->pluginspath . "profile/index.php");
-                       }
-               }
-
-       /**
-        * Profile edit page handler
-        *
-        * @param array $page Array of page elements, forwarded by the page handling mechanism
-        */
-               function profileedit_page_handler($page) {
-
-                       global $CONFIG;
-
-                       // The username should be the file we're getting
-                       if (isset($page[0])) {
-                               switch ($page[0])
-                               {
-                                       default: include($CONFIG->pluginspath . "profile/defaultprofile.php");
-                               }
-                       }
-
-               }
-
-       /**
-        * Pagesetup function
-        *
-        */
-               function profile_pagesetup()
-               {
-                       global $CONFIG;
-                       if (get_context() == 'admin' && isadminloggedin()) {
-
-                               add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/');
-                       }
-
-                       //add submenu options
-                       if (get_context() == "profile") {
-                               $page_owner = page_owner_entity();
-
-                               add_submenu_item(elgg_echo('profile:editdetails'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/edit/");
-                               add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/editicon/");
-                       }
-               }
-
-       /**
-        * Profile icon page handler
-        *
-        * @param array $page Array of page elements, forwarded by the page handling mechanism
-        */
-               function profile_icon_handler($page) {
-
-                       global $CONFIG;
-
-                       // The username should be the file we're getting
-                       if (isset($page[0])) {
-                               set_input('username',$page[0]);
-                       }
+               default:
                        if (isset($page[1])) {
-                               set_input('size',$page[1]);
+                               $section = $page[1];
+                       } else {
+                               $section = 'activity';
                        }
-                       // Include the standard profile index
-                       include($CONFIG->pluginspath . "profile/icon.php");
-
+                       $content = profile_get_user_profile_html($user, $section);
+                       break;
+       }
+
+       $content = elgg_view_layout('one_column', $content);
+
+       page_draw($title, $content);
+       return;
+}
+
+/**
+ * Profile edit page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+function profileedit_page_handler($page) {
+       global $CONFIG;
+
+       // The username should be the file we're getting
+       if (isset($page[0])) {
+               switch ($page[0]) {
+                       default:
+                               include($CONFIG->pluginspath . "profile/defaultprofile.php");
+                               break;
                }
-
-       /**
-        * Icon JS
-        */
-               function profile_iconjs_handler($page) {
-
-                       global $CONFIG;
-
-                       include($CONFIG->pluginspath . "profile/javascript.php");
-
+       }
+}
+
+/**
+ * Pagesetup function
+ *
+ */
+function profile_pagesetup()
+{
+       global $CONFIG;
+       if (get_context() == 'admin' && isadminloggedin()) {
+               add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/');
+       }
+
+       //add submenu options
+       if (get_context() == "profile") {
+               $page_owner = page_owner_entity();
+               add_submenu_item(elgg_echo('profile:editdetails'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/edit/details");
+               add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . "pg/profile/{$page_owner->username}/edit/icon");
+       }
+}
+
+/**
+ * Profile icon page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+function profile_icon_handler($page) {
+       global $CONFIG;
+
+       // The username should be the file we're getting
+       if (isset($page[0])) {
+               set_input('username',$page[0]);
+       }
+       if (isset($page[1])) {
+               set_input('size',$page[1]);
+       }
+       // Include the standard profile index
+       include($CONFIG->pluginspath . "profile/icon.php");
+}
+
+/**
+ * Icon JS
+ */
+function profile_iconjs_handler($page) {
+       global $CONFIG;
+       include($CONFIG->pluginspath . "profile/javascript.php");
+}
+
+/**
+ * Profile URL generator for $user->getUrl();
+ *
+ * @param ElggUser $user
+ * @return string User URL
+ */
+function profile_url($user) {
+       global $CONFIG;
+       return $CONFIG->wwwroot . "pg/profile/" . $user->username;
+}
+
+/**
+ * This hooks into the getIcon API and provides nice user icons for users where possible.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+function profile_usericon_hook($hook, $entity_type, $returnvalue, $params){
+       global $CONFIG;
+       if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggUser)){
+               $entity = $params['entity'];
+               $type = $entity->type;
+               $subtype = get_subtype_from_id($entity->subtype);
+               $viewtype = $params['viewtype'];
+               $size = $params['size'];
+               $username = $entity->username;
+
+               if ($icontime = $entity->icontime) {
+                       $icontime = "{$icontime}";
+               } else {
+                       $icontime = "default";
                }
 
-       /**
-        * Profile URL generator for $user->getUrl();
-        *
-        * @param ElggUser $user
-        * @return string User URL
-        */
-               function profile_url($user) {
-                       global $CONFIG;
-                       return $CONFIG->wwwroot . "pg/profile/" . $user->username;
+               if ($entity->isBanned()) {
+                       return elgg_view('icon/user/default/'.$size);
                }
 
-       /**
-        * This hooks into the getIcon API and provides nice user icons for users where possible.
-        *
-        * @param unknown_type $hook
-        * @param unknown_type $entity_type
-        * @param unknown_type $returnvalue
-        * @param unknown_type $params
-        * @return unknown
-        */
-               function profile_usericon_hook($hook, $entity_type, $returnvalue, $params)
-               {
-                       global $CONFIG;
-
-                       if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggUser))
-                       {
-
-                               $entity = $params['entity'];
-                               $type = $entity->type;
-                               $subtype = get_subtype_from_id($entity->subtype);
-                               $viewtype = $params['viewtype'];
-                               $size = $params['size'];
-                               $username = $entity->username;
-
-                               if ($icontime = $entity->icontime) {
-                                       $icontime = "{$icontime}";
-                               } else {
-                                       $icontime = "default";
-                               }
-
-                               if ($entity->isBanned()) {
-                                       return elgg_view('icon/user/default/'.$size);
-                               }
-
-                               $filehandler = new ElggFile();
-                               $filehandler->owner_guid = $entity->getGUID();
-                               $filehandler->setFilename("profile/" . $username . $size . ".jpg");
-
-                               if ($filehandler->exists()) {
-                                       //$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg";
-                                       return $CONFIG->wwwroot . 'mod/profile/icondirect.php?lastcache='.$icontime.'&amp;username='.$entity->username.'&amp;size='.$size;
-                               }
-                       }
+               $filehandler = new ElggFile();
+               $filehandler->owner_guid = $entity->getGUID();
+               $filehandler->setFilename("profile/" . $username . $size . ".jpg");
+
+               if ($filehandler->exists()) {
+                       //$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg";
+                       return $CONFIG->wwwroot . 'mod/profile/icondirect.php?lastcache='.$icontime.'&amp;username='.$entity->username.'&amp;size='.$size;
                }
+       }
+}
 
-       // Make sure the profile initialisation function is called on initialisation
-               register_elgg_event_handler('init','system','profile_init',1);
-               register_elgg_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins
+// Make sure the profile initialisation function is called on initialisation
+register_elgg_event_handler('init','system','profile_init',1);
+register_elgg_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins
 
-               register_elgg_event_handler('pagesetup','system','profile_pagesetup');
-               register_elgg_event_handler('profileupdate','all','object_notifications');
+register_elgg_event_handler('pagesetup','system','profile_pagesetup');
+register_elgg_event_handler('profileupdate','all','object_notifications');
 
 
-       // Register actions
-               global $CONFIG;
-               register_action("profile/edit",false,$CONFIG->pluginspath . "profile/actions/edit.php");
-               register_action("profile/iconupload",false,$CONFIG->pluginspath . "profile/actions/iconupload.php");
-               register_action("profile/cropicon",false,$CONFIG->pluginspath . "profile/actions/cropicon.php");
-               register_action("profile/editdefault",false,$CONFIG->pluginspath . "profile/actions/editdefault.php", true);
-               register_action("profile/editdefault/delete",false,$CONFIG->pluginspath . "profile/actions/deletedefaultprofileitem.php", true);
-               register_action("profile/editdefault/reset",false,$CONFIG->pluginspath . "profile/actions/resetdefaultprofile.php", true);
+// Register actions
+global $CONFIG;
+register_action("profile/edit",false,$CONFIG->pluginspath . "profile/actions/edit.php");
+register_action("profile/iconupload",false,$CONFIG->pluginspath . "profile/actions/iconupload.php");
+register_action("profile/cropicon",false,$CONFIG->pluginspath . "profile/actions/cropicon.php");
+register_action("profile/editdefault",false,$CONFIG->pluginspath . "profile/actions/editdefault.php", true);
+register_action("profile/editdefault/delete",false,$CONFIG->pluginspath . "profile/actions/deletedefaultprofileitem.php", true);
+register_action("profile/editdefault/reset",false,$CONFIG->pluginspath . "profile/actions/resetdefaultprofile.php", true);
 
 
-       // Define widgets for use in this context
-               use_widgets('profile');
-?>
\ No newline at end of file
+// Define widgets for use in this context
+use_widgets('profile');
\ No newline at end of file
diff --git a/mod/profile/views/default/profile/admin_menu.php b/mod/profile/views/default/profile/admin_menu.php
new file mode 100755 (executable)
index 0000000..c895056
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/** 
+ * This is the admin menu that appears on a user's profile page
+ **/
+global $CONFIG;
+
+if (isadminloggedin()){
+       if ($_SESSION['id']!=page_owner()){
+               $user = get_user(page_owner());
+               $url = $vars['url'];
+               $ts = time();
+               $token = generate_action_token($ts);
+
+?>
+<div class="owner_block_links">
+<ul class="admin_menu">
+<li><a href="#" onclick="elgg_slide_toggle(this,'.owner_block_links','.admin_menu_options');">Admin options&hellip;</a>
+       
+       <ul class="admin_menu_options">
+       <li><a href="<?php echo $url; ?>pg/settings/user/<?php echo $user->username; ?>/"><?php echo elgg_echo('profile:editdetails'); ?></a></li>      
+       <?php
+               if (!$user->isBanned()) {
+                       echo "<li>".elgg_view('output/confirmlink', array('text' => elgg_echo("ban"), 'href' => "{$url}action/admin/user/ban?guid={$user->guid}&__elgg_token=$token&__elgg_ts=$ts")) . "</li>";
+               } else {
+                       echo "<li>".elgg_view('output/confirmlink', array('text' => elgg_echo("unban"), 'href' => "{$url}action/admin/user/unban?guid={$user->guid}&__elgg_token=$token&__elgg_ts=$ts")) . "</li>"; 
+               }
+               echo "<li>".elgg_view('output/confirmlink', array('text' => elgg_echo("delete"), 'href' => "{$url}action/admin/user/delete?guid={$user->guid}&__elgg_token=$token&__elgg_ts=$ts")) . "</li>";
+               echo "<li>".elgg_view('output/confirmlink', array('text' => elgg_echo("resetpassword"), 'href' => "{$url}action/admin/user/resetpassword?guid={$user->guid}&__elgg_token=$token&__elgg_ts=$ts")) . "</li>";
+               if (!$vars['entity']->admin) { 
+                       echo "<li>".elgg_view('output/confirmlink', array('text' => elgg_echo("makeadmin"), 'href' => "{$url}action/admin/user/makeadmin?guid={$user->guid}&__elgg_token=$token&__elgg_ts=$ts")) . "</li>";
+               } else {
+                       echo "<li>".elgg_view('output/confirmlink', array('text' => elgg_echo("removeadmin"), 'href' => "{$url}action/admin/user/removeadmin?guid={$user->guid}&__elgg_token=$token&__elgg_ts=$ts")) . "</li>";
+               }
+       ?>
+       </ul>
+</li>  
+</ul>  
+</div>
+<?php
+       }
+}
+?>
index cf95d9bdbda07dffda711dc11f90ff76e0dda3da..b475b6bddc3300a9cacb4f8407c2edd5ede22daa 100644 (file)
 <?php
-
-       /**
-        * Elgg Profile 
-        * 
-        * @package Profile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-        
+/**
+ * Elgg Profile 
+ * 
+ * @package Profile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 ?>
-
-#profile_icon_wrapper {
+/* ***************************************
+       main layout blocks
+*************************************** */
+#profile_content {
+       float:right;
+       width:700px;
+       position: relative;
+}
+#profile_sidebar {
+       width:230px;
        float:left;
 }
-       
+.elgg_horizontal_tabbed_nav.profile {
+       margin-top:0px;
+       margin-bottom:25px;
+       position:relative;
+}
+.elgg_horizontal_tabbed_nav.profile .profile_name {
+       display:block;
+       width:265px;
+       position:absolute;
+}
+.elgg_horizontal_tabbed_nav.profile .profile_name h2 {
+       margin:0;
+       padding:0;
+       border:none;
+}
+.elgg_horizontal_tabbed_nav.profile ul {
+       margin-left:260px;
+}
+
+/* ***************************************
+       default avatar icons
+*************************************** */
 .usericon {
        position:relative;
 }
+.usericon.tiny {
+       width:25px;
+       height:25px;
+}
+.usericon.small {
+       width:40px;
+       height:40px;
+}
+
+/* ***************************************
+       ownerblock in sidebar
+*************************************** */
+#profile_sidebar #owner_block {
+       background-color: #eeeeee;
+       -webkit-border-radius: 8px; 
+       -moz-border-radius: 8px;
+       padding:15px;
+       min-height:270px;
+}
+#owner_block .owner_block_icon {
+       float:left;
+       padding:0;
+       margin:0;
+}
+#owner_block .owner_block_icon.large {
+       width:200px;
+       height:200px;
+       overflow: hidden;
+       float:none;
+}
+#owner_block .owner_block_contents {
+       margin-left: 50px;
+}
+#owner_block .owner_block_contents h3 {
+       margin-top:-4px;
+}
+#owner_block .owner_block_contents p.profile_info {
+       margin:0;
+       padding:0;
+       color: #666666;
+}
+#owner_block .owner_block_contents p.profile_info.briefdescription {
+       font-size: 90%;
+       line-height:1.2em;
+       font-style: italic;
+}
+#owner_block .owner_block_contents p.profile_info.location {
+       font-size: 90%;
+}
+#owner_block .profile_actions {
+       margin-top:10px;
+}
+#owner_block .profile_actions a.action_button {
+       margin-bottom:4px;
+       display: table;
+}
+/* ownerblock links to owners tools */
+.owner_block_links {
+       margin-top:5px;
+}
+.owner_block_links ul {
+       margin:0;
+       padding:0;
+       list-style: none;
+}
+.owner_block_links ul li.selected a {
+       background: #4690D6;
+       color:white;
+}
+.owner_block_links ul li a {
+       display:block;
+       -webkit-border-radius: 8px; 
+       -moz-border-radius: 8px;
+       background-color:white;
+       margin:3px 0 5px 0;
+       padding:2px 4px 2px 8px;
+}
+.owner_block_links ul li a:hover {
+       background:#0054A7;
+       color:white;
+       text-decoration:none;
+}
+
+
+/* ***************************************
+       admin menu in sidebar
+*************************************** */
+.owner_block_links .admin_menu_options {
+       display: none;
+}
+.owner_block_links ul.admin_menu {
+       background-color:white;
+       -webkit-border-radius: 8px;
+       -moz-border-radius: 8px;
+       cursor:pointer;
+}
+.owner_block_links ul.admin_menu li a {
+       background-color: red;
+       color:white;
+       margin-bottom:0;
+}
+.owner_block_links ul.admin_menu li ul.admin_menu_options li a {
+       color:red;
+       background-color:white;
+       display:block;
+       margin:0px;
+       padding:2px 4px 2px 13px;
+}
+.owner_block_links ul.admin_menu li ul.admin_menu_options li a:hover {
+       color:black;
+       background:none;
+       text-decoration: underline;
+}
+
+
+/* ***************************************
+       full profile info panel
+*************************************** */
+#profile_content .odd {
+       background-color:#f4f4f4;
+       -webkit-border-radius: 4px; 
+       -moz-border-radius: 4px;
+       margin:0 0 7px 0;
+       padding:2px 4px 2px 4px;
+}
+#profile_content .even {
+       background-color:#f4f4f4;
+       -webkit-border-radius: 4px; 
+       -moz-border-radius: 4px;
+       margin:0 0 7px 0;
+       padding:2px 4px 2px 4px;
+}
+#profile_content .aboutme_title {
+       background-color:#f4f4f4;
+       -webkit-border-radius: 4px; 
+       -moz-border-radius: 4px;
+       margin:0 0 0px 0;
+       padding:2px 4px 2px 4px;
+}
+#profile_content .aboutme_contents {
+       padding:2px 0 0 3px;
+}
+
 
+/* ***************************************
+       friends panel within profile
+*************************************** */
+#profile_content .entity_listing .entity_listing_info {
+       width:664px;
+}
+
+
+/* ***************************************
+       twitter panel within profile
+*************************************** */
+ul#twitter_update_list li {
+       background-image: url(<?php echo $vars['url']; ?>mod/elgg_layout/graphics/speech_bubble_tail.gif);
+       background-position:right bottom;
+       background-repeat: no-repeat;
+       list-style-image:none;
+       list-style-position:outside;
+       list-style-type:none;
+       margin:0 0 5px 0;
+       padding:0;
+       overflow-x: hidden;
+}
+ul#twitter_update_list li span {
+       color:#666666;
+       background:#ececec;
+       -webkit-border-radius: 4px; 
+       -moz-border-radius: 4px;
+       padding:3px 5px 4px 5px;
+       display:block;
+}
+ul#twitter_update_list li a {
+       display:block;
+       margin:-2px 0 0 4px;
+}
+ul#twitter_update_list li span a {
+       display:inline !important;
+}
+p.visit_twitter a {
+    background:url(<?php echo $vars['url']; ?>mod/elgg_layout/graphics/twitter16px.png) left no-repeat;
+    padding:0 0 0 20px;
+    margin:0;
+}
+.visit_twitter {
+       padding:5px 0;
+       margin:0 0 0 0;
+       border-top:1px solid #dedede;
+}
+
+
+/* ***************************************
+       edit profile page
+*************************************** */
+form#edit_profile {
+       margin-top:10px;
+}
+
+
+/* ***************************************
+       user avatar upload & crop page
+*************************************** */
+#avatar_upload {
+       height:145px;
+}      
+#current_user_avatar {
+       float:left;
+       width:160px;
+       height:130px;
+       border-right:1px solid #cccccc;
+       margin:0 20px 0 0;
+}      
+#avatar_croppingtool {
+       border-top: 1px solid #cccccc;
+       margin:20px 0 0 0;
+       padding:10px 0 0 0;
+}      
+#avatar_croppingtool .current_user_avatar {
+       float: left;
+       margin-right: 20px;
+}      
+#avatar_croppingtool .user_avatar_crop_preview {
+       float: left;
+       position: relative;
+       overflow: hidden;
+       width: 100px;
+       height: 100px;
+}
+
+
+/* ***************************************
+       banned user
+*************************************** */
+/* banned user full profile panel */
+#profile_content .banned_user {
+       border:2px solid red;
+       padding:4px 8px;
+       -webkit-border-radius: 6px; 
+       -moz-border-radius: 6px;
+}
+/* banned user in friends lists */
+.entity_listing_info p.entity_title.user.banned {
+       text-decoration: line-through;
+}
+.entity_listing_info p.entity_title.user.banned a {
+       color:red;
+}
+
+
+/* ***************************************
+       admin area - custom profile fields
+*************************************** */
+.default_profile_reset {
+       border-top: 1px solid #dedede;
+       margin-top:30px;
+}
+.default_profile_reset input[type="submit"] {
+       background: #dedede;
+       border-color: #dedede;
+       color:#666666;
+       text-shadow: none;
+       float:right;
+}
+.default_profile_reset input[type="submit"]:hover {
+       background: red;
+       border-color: red;
+       color:white;
+}
+
+
+/* ***************************************
+       avatar drop-down menu
+*************************************** */
 .avatar_menu_button {
        width:15px;
        height:15px;
        width:15px;
        height:15px;
 }
+/* user avatar submenu options */
 .usericon div.sub_menu { 
        display:none; 
        position:absolute; 
-       padding:2px
+       padding:0
        margin:0; 
        border-top:solid 1px #E5E5E5; 
        border-left:solid 1px #E5E5E5; 
        border-right:solid 1px #999999; 
        border-bottom:solid 1px #999999;  
-       width:160px; 
+       width:164px; 
        background:#FFFFFF; 
        text-align:left;
+       -webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); /* safari v3+ */
+       -moz-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.50); /* FF v3.5+ */
 }
 div.usericon a.icon img {
        z-index:10;
 }
-
-.usericon div.sub_menu a {margin:0;padding:2px;}
 .usericon div.sub_menu a:link, 
 .usericon div.sub_menu a:visited, 
-.usericon div.sub_menu a:hover{ display:block;}        
-.usericon div.sub_menu a:hover{ background:#cccccc; text-decoration:none;}
-
+.usericon div.sub_menu a:hover { 
+       display:block;
+}      
+.usericon div.sub_menu a:hover {
+       background:#cccccc;
+       text-decoration:none;
+}
 .usericon div.sub_menu h3 {
-       font-size:1.2em;
-       padding-bottom:3px;
+       font-size:1.3em;
+       line-height: 1.1em;
+       padding:0;
        border-bottom:solid 1px #dddddd;
        color: #4690d6;
        margin:0 !important;
 }
-.usericon div.sub_menu h3:hover {
-
+.usericon div.sub_menu h3 a {
+       padding:3px 3px 3px 6px !important;
 }
-
-.user_menu_addfriend,
-.user_menu_removefriend,
-.user_menu_profile,
-.user_menu_friends,
-.user_menu_friends_of,
-.user_menu_blog,
-.user_menu_file,
-.user_menu_messages,
-.user_menu_admin,
-.user_menu_pages {
-       margin:0;
-       padding:0;
+.usericon div.sub_menu p {
+       margin:0 !important;
+       padding:0 !important;
+       height:auto !important;
+       line-height:1.2em !important;
+       font-size:12px !important;
 }
+.usericon div.sub_menu p a {
+       padding:3px 3px 3px 6px !important;
+}
+/* admin menu options in avatar submenu */
 .user_menu_admin {
        border-top:solid 1px #dddddd;
 }
@@ -101,24 +405,48 @@ div.usericon a.icon img {
        color:white !important;
        background:red !important;
 }
+/* /////////////////////////////////////////////////////////////// >>>END verified */
+
 
-.resetdefaultprofile {
-       padding:0 10px 0 10px;
+
+/*
+#profile_status_wrapper {
+       background-color:#eeeeee;
+       -webkit-border-radius: 4px; 
+       -moz-border-radius: 4px;
+       padding:2px 4px 2px 4px;
+       margin:0 0 7px 0;
+       line-height:1.2em;
+       min-height:16px;
+       
+       position: relative;
 }
-.resetdefaultprofile input[type="submit"] {
-       background: #dedede;
-       border-color: #dedede;
-       color:#333333;
+#profile_status_wrapper.inline {
+       margin-top:10px;
 }
-.resetdefaultprofile input[type="submit"]:hover {
-       background: red;
-       border-color: red;
-       color:white;
+.profile_status span {
+       display:block;
+       font-size:90%;
+       color:#666666;  
 }
+a.status_update {
+       float:right;    
+}
+div.profile_status {
+       z-index: 2;
+       position: relative;
+}
+#profile_status_tail {
+       position: absolute;
+       width:17px;
+       height:12px;
+       left:-11px;
+       bottom:-5px;
 
-/* Banned user */
-#profile_banned {
-       background-color:#FF8888;
-       border:3px solid #FF0000;
-       padding:2px;
-}
\ No newline at end of file
+       background-image: url(<?php echo $vars['url']; ?>mod/thewire/graphics/speech_tail.png);
+       background-position: 0 0;
+       background-repeat: no-repeat;
+       background-color:transparent;
+       z-index: 1;
+}
+*/
\ No newline at end of file
index 11e3c2997e98781d264ca0d8823210efba5d028e..06d7bcfe22996fe2624f47e171a25f086f1029bc 100644 (file)
@@ -1,25 +1,28 @@
 <?php
-
-       /**
-        * Elgg profile edit form
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity
-        * @uses $vars['profile'] Profile items from $CONFIG->profile, defined in profile/start.php for now 
-        */
-
+/**
+ * Elgg profile edit form
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity
+ * @uses $vars['profile'] Profile items from $CONFIG->profile, defined in profile/start.php for now 
+ */
 ?>
-<div class="contentWrapper">
-<form action="<?php echo $vars['url']; ?>action/profile/edit" method="post">
+<form action="<?php echo $vars['url']; ?>action/profile/edit" method="post" id="edit_profile">
 <?php echo elgg_view('input/securitytoken') ?>
-<?php
 
-       //var_export($vars['profile']);
+       <p><label>
+               <?php echo elgg_echo('user:name:label'); ?></label>
+               <?php   
+                       echo elgg_view('input/text',array('internalname' => 'name', 'value' => page_owner_entity()->name));
+               ?>
+       </p>
+
+<?php
        if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0)
                foreach($vars['config']->profile as $shortname => $valtype) {
                        if ($metadata = get_metadata_byname($vars['entity']->guid, $shortname)) {
@@ -63,5 +66,4 @@
                <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />
        </p>
 
-</form>
-</div>
\ No newline at end of file
+</form>
\ No newline at end of file
index 73f0a8783ce0f177f4cfee0c08a464d2b59a8622..42680f4df3cbcb8de3c2c08dea3d1942ea8580ec 100644 (file)
@@ -1,35 +1,33 @@
 <?php
-       /**
       * Elgg profile index
       
       * @package ElggProfile
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Curverider Ltd <info@elgg.com>
       * @copyright Curverider Ltd 2008-2010
       * @link http://elgg.com/
       */
+/**
+ * Elgg profile index
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       $label_text = elgg_echo('profile:label');
-       $type_text = elgg_echo('profile:type');
+$label_text = elgg_echo('profile:label');
+$type_text = elgg_echo('profile:type');
 
-       $label_control = elgg_view('input/text', array('internalname' => 'label'));
-       $type_control = elgg_view('input/pulldown', array('internalname' => 'type', 'options_values' => array(
-               'text' => elgg_echo('text'),
-               'longtext' => elgg_echo('longtext'),
-               'tags' => elgg_echo('tags'),
-               'url' => elgg_echo('url'),
-               'email' => elgg_echo('email')
-       )));
+$label_control = elgg_view('input/text', array('internalname' => 'label'));
+$type_control = elgg_view('input/pulldown', array('internalname' => 'type', 'options_values' => array(
+       'text' => elgg_echo('text'),
+       'longtext' => elgg_echo('longtext'),
+       'tags' => elgg_echo('tags'),
+       'url' => elgg_echo('url'),
+       'email' => elgg_echo('email')
+)));
        
-       $submit_control = elgg_view('input/submit', array('internalname' => elgg_echo('save'), 'value' => elgg_echo('save')));
+$submit_control = elgg_view('input/submit', array('internalname' => elgg_echo('save'), 'value' => elgg_echo('Add')));
        
-       $formbody = <<< END
-                       <p>$label_text: $label_control
-                       $type_text: $type_control
-                       $submit_control</p>
+$formbody = <<< END
+               <p>$label_text: $label_control
+               $type_text: $type_control
+               $submit_control</p>
 END;
-       echo "<div class=\"contentWrapper\">";
-       echo "<p>" . elgg_echo('profile:explainchangefields') . "</p>";
-       echo elgg_view('input/form', array('body' => $formbody, 'action' => $vars['url'] . 'action/profile/editdefault'));
-       echo "</div>";
-?>
\ No newline at end of file
+
+echo "<p>" . elgg_echo('profile:explainchangefields') . "</p>";
+echo elgg_view('input/form', array('body' => $formbody, 'action' => $vars['url'] . 'action/profile/editdefault'));
index 7731d989945e559bc18e9eba6e6d38db89c52009..20e16b97849d853aef3081df1e631f6c854f0760 100644 (file)
@@ -1,24 +1,21 @@
 <?php
-
-       /**
-        * Elgg profile icon edit form
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity
-        * @uses $vars['profile'] Profile items from $CONFIG->profile, defined in profile/start.php for now 
-        */
-
-       // user is passed to view and set by caller (normally the page editicon)
-       $currentuser = $vars['user'];
-
+/**
+ * Elgg profile icon edit form
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity
+ * @uses $vars['profile'] Profile items from $CONFIG->profile, defined in profile/start.php for now 
+ */
+
+// user is passed to view and set by caller (normally the page editicon)
+$currentuser = $vars['user'];
 ?>
 <!-- grab the required js for icon cropping -->
-<div class="contentWrapper">
 <script type="text/javascript" src="<?php echo $vars['url']; ?>mod/profile/views/default/js/jquery.imgareaselect-0.8.min.js"></script>
 
 <p><?php echo elgg_echo('profile:profilepictureinstructions'); ?></p>
        <?php 
                
                $user_avatar = $currentuser->getIcon('medium');
-               echo "<img src=\"{$user_avatar}\" alt=\"avatar\" />";
+               echo "<img src='{$user_avatar}' alt='avatar' />";
 
        ?>
 
 </div>
 
-<div id="profile_picture_form">
+<div id="avatar_upload">
        <form action="<?php echo $vars['url']; ?>action/profile/iconupload" method="post" enctype="multipart/form-data">
        <?php echo elgg_view('input/securitytoken'); ?>
        <input type="hidden" name="username" value="<?php echo $currentuser->username; ?>" />
        </form>
 </div>
        
-<div id="profile_picture_croppingtool">        
+<div id="avatar_croppingtool"> 
 <label><?php echo elgg_echo('profile:profilepicturecroppingtool'); ?></label><br />
 <p>    
 <?php
-
     echo elgg_echo("profile:createicon:instructions");
-    
     //display the current user photo
-     
     $user_master_image = $currentuser->getIcon('master');
-    
 ?>
 </p>
 <script type="text/javascript">
-
     //function to display a preview of the users cropped section
     function preview(img, selection) {
                // catch for the first click on the image
                        return;
                }
                
-        var origWidth = $("#user_avatar").width(); //get the width of the users master photo
-        var origHeight = $("#user_avatar").height(); //get the height of the users master photo
+        var origWidth = $(".current_user_avatar").width(); //get the width of the users master photo
+        var origHeight = $(".current_user_avatar").height(); //get the height of the users master photo
         var scaleX = 100 / selection.width; 
         var scaleY = 100 / selection.height; 
-        $('#user_avatar_preview > img').css({ 
+        $('.user_avatar_crop_preview > img').css({ 
             width: Math.round(scaleX * origWidth) + 'px', 
             height: Math.round(scaleY * origHeight) + 'px', 
             marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', 
          }); 
     } 
         
-    //variables for the newly cropped avatar
-    //var $x1, $y1, $x2, $y2, $w, $h;
-        
-        function selectChange(img, selection){
-           
+    function selectChange(img, selection){
            //populate the form with the correct coordinates once a user has cropped their image
            $('#x_1').val(selection.x1);
            $('#x_2').val(selection.x2);
            $('#y_1').val(selection.y1);
            $('#y_2').val(selection.y2);
-           
-         }     
+     }     
          
-        $(document).ready(function () {
-            
-            //get the coordinates from the form
-            /*
-            var x_1 = $('#x_1').val();
-            var x_2 = $('#x_2').val();
-            var y_1 = $('#y_1').val();
-            var y_2 = $('#y_2').val();
-            var w = x_2 - x_1;
-            var h = y_2 - y_1;
-            selection = { x1: x_1, y1: y_1, x2: x_2, y2: y_2, width: w, height: h };
-            */
-            
-            $('<div id="user_avatar_preview"><img src="<?php echo $user_master_image; ?>" /></div>') 
-            .insertAfter($('#user_avatar'));
+    $(document).ready(function () {
             
-            $('<div id="user_avatar_preview_title"><label><?php echo elgg_echo('profile:preview'); ?></label></div>').insertBefore($('#user_avatar_preview'));
-        }); 
+        $('<div class="user_avatar_crop_preview"><img src="<?php echo $user_master_image; ?>" /></div>') 
+        .insertAfter($('.current_user_avatar'));
         
-        $(window).load(function () { 
-            
-            //this produces the coordinates
-            $('#user_avatar').imgAreaSelect({ selectionOpacity: 0, onSelectEnd: selectChange });
-            //show the preview
-            $('#user_avatar').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview });
+        $('<label><?php echo elgg_echo('profile:preview'); ?></label><br />').insertBefore($('.user_avatar_crop_preview'));
+    }); 
+        
+    $(window).load(function () { 
+        //this produces the coordinates
+        $('.current_user_avatar').imgAreaSelect({ selectionOpacity: 0, onSelectEnd: selectChange });
+        //show the preview
+        $('.current_user_avatar').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview });
   
-        });
+    });
 </script>
 
-<p>
-<img id="user_avatar" src="<?php echo $user_master_image; ?>" alt="<?php echo elgg_echo("profile:icon"); ?>" />
-</p>
-
-<div class="clearfloat"></div>
+<div id="avatar_cropping" class="clearfloat">
+       <img class="current_user_avatar" src="<?php echo $user_master_image; ?>" alt="<?php echo elgg_echo("profile:icon"); ?>" />
+</div>
 
 <form action="<?php echo $vars['url']; ?>action/profile/cropicon" method="post" />
        <?php echo elgg_view('input/securitytoken'); ?>
 </form>
 
 </div>
-<div class="clearfloat"></div>
-
-</div>
diff --git a/mod/profile/views/default/profile/gallery.php b/mod/profile/views/default/profile/gallery.php
deleted file mode 100644 (file)
index ffbabfc..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-       /**
-        * Elgg user display (gallery)
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity
-        */
-        
-           //grab the users status message with metadata 'state' set to current if it exists
-/*             if($get_status = get_entities_from_metadata("state", "current", "object", "status", $vars['entity']->guid)){
-                   
-            foreach($get_status as $s) {
-                   $info = elgg_view("status/friends_view", array('entity' => $s));
-            }
-                   
-               } */
-
-               $icon = elgg_view(
-                               "profile/icon", array(
-                                                                               'entity' => $vars['entity'],
-                                                                               'size' => 'medium',
-                                                                         )
-                       );
-                       
-               $banned = $vars['entity']->isBanned();
-       
-               $rel = "";
-               if (page_owner() == $vars['entity']->guid)
-                       $rel = 'me';
-               else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
-                       $rel = 'friend';
-               
-               if (!$banned)
-                       $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
-               else
-                       $info .= "<p><b><strike>" . $vars['entity']->name . "</b></strike><br />".elgg_echo('profile:banned')."</p>";
-               
-               // echo elgg_view_listing($icon, $info);
-               echo elgg_view('search/gallery_listing',array('icon' => $icon, 'info' => $info));
-                       
-?>
\ No newline at end of file
index 678fbbada884cc30f4fefecedbc704d33664e7aa..571585311c1603838d0eb03b75ad19a2de244890 100644 (file)
@@ -1,26 +1,20 @@
 <?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 Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
-        */
-
+/**
+ * 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 Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @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>
-
+<p class="user_menu_name">
+       <b><?php echo $vars['entity']->name; ?></b>
+</p>
 <?php
-
-       echo elgg_view("profile/hoverover/actions",$vars);
-       echo elgg_view("profile/hoverover/links",$vars);
-
+       echo elgg_view('profile/hoverover/actions', $vars);
+       echo elgg_view('profile/hoverover/links', $vars);
 ?>
\ No newline at end of file
index 3fd6ab87be5f9d380cd95436881edae20a12ffae..59b16cdac8421b17d04da1a5e83dd49e87019342 100644 (file)
@@ -1,53 +1,54 @@
 <?php
 
-       /**
       * Elgg profile icon
       
       * @package ElggProfile
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Curverider Ltd <info@elgg.com>
       * @copyright Curverider Ltd 2008-2010
       * @link http://elgg.com/
       
       * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
       * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. 
       */
+/**
+ * Elgg profile icon
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
+ * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. 
+ */
 
-       // Get entity
-               if (empty($vars['entity']))
-                       $vars['entity'] = $vars['user'];
+// Get entity
+if (empty($vars['entity'])) {
+       $vars['entity'] = $vars['user'];
+}
 
-               if ($vars['entity'] instanceof ElggUser) {
-                       
-               $name = htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8');
-               $username = $vars['entity']->username;
-               
-               if ($icontime = $vars['entity']->icontime) {
-                       $icontime = "{$icontime}";
-               } else {
-                       $icontime = "default";
-               }
-                       
+if ($vars['entity'] instanceof ElggUser) {
+       $name = htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8');
+       $username = $vars['entity']->username;
+
+       if ($icontime = $vars['entity']->icontime) {
+               $icontime = "{$icontime}";
+       } else {
+               $icontime = "default";
+       }
+       
        // Get size
-               if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar')))
-                       $vars['size'] = "medium";
-                       
+       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 = "";
-               }
+       if (!empty($vars['align'])) {
+               $align = " align=\"{$vars['align']}\" ";
+       } else {
+               $align = '';
+       }
 
        // Override
-               if (isset($vars['override']) && $vars['override'] == true) {
-                       $override = true;
-               } else $override = false;
-               
-               if (!$override) {
-               
+       if (isset($vars['override']) && $vars['override'] == true) {
+               $override = true;
+       } else $override = false;
+
+       if (!$override) {
+       
 ?>
-<div class="usericon">
+<div class="usericon <?php echo $vars['size']; ?>">
 <div class="avatar_menu_button"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" border="0" width="15px" height="15px" /></div>
 
        <div class="sub_menu">
@@ -79,7 +80,7 @@
        
        ?><img src="<?php echo $vars['entity']->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> alt="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $vars['js']; ?> /><?php
 
-               if (!$override) {
+       if (!$override) {
        
        ?></a>
 </div>
@@ -87,6 +88,4 @@
 <?php
 
        }
-               }
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index f2ad4b74bfc386a87aaf37b884ac5e1097f4d778..a408d1c841acc11564f433f556be2efdcafbfe47 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 
-       /**
       * Elgg profile image Javascript
       
       * @package ElggProfile
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Curverider
       * @copyright Curverider Ltd 2008-2010
       * @link http://elgg.com/
       
       * @uses $vars['entity'] The user entity
       */
+/**
+ * Elgg profile image Javascript
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity
+ */
 
 //             header("Content-type: text/javascript");
 //             header("Pragma: public");
index cb65c93a6acc31e260ac047c3ece0610c8097f8f..942910bc3d56270170f549976fd9c8f150427884 100644 (file)
@@ -1,57 +1,48 @@
 <?php
-
-       /**
-        * Elgg user display (small)
-        *
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        *
-        * @uses $vars['entity'] The user entity
-        */
-
-               $icon = elgg_view(
-                               "profile/icon", array(
-                                                                               'entity' => $vars['entity'],
-                                                                               'size' => 'small',
-                                                                       )
-                       );
-
-               $banned = $vars['entity']->isBanned();
-
-               // Simple XFN
-               $rel = "";
-               if (page_owner() == $vars['entity']->guid)
-                       $rel = 'me';
-               else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
-                       $rel = 'friend';
-
-               if (!$banned) {
-                       $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
-                       //create a view that a status plugin could extend - in the default case, this is the wire
-                       $info .= elgg_view("profile/status", array("entity" => $vars['entity']));
-
-                       $location = $vars['entity']->location;
-                       if (!empty($location)) {
-                               $info .= "<p class=\"owner_timestamp\">" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
-                       }
-               }
-               else
-               {
-                       $info .= "<p><b><strike>";
-                       if (isadminloggedin())
-                               $info .= "<a href=\"" . $vars['entity']->getUrl() . "\">";
-                       $info .= $vars['entity']->name;
-                       if (isadminloggedin())
-                               $info .= "</a>";
-                       $info .= "</strike></b></p>";
-
-                       //$info .= "<p class=\"owner_timestamp\">" . elgg_echo('profile:banned') . "</p>";
-
-               }
-
-               echo elgg_view_listing($icon, $info);
-
-?>
\ No newline at end of file
+/**
+ * Elgg user display (small)
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The user entity
+ */
+
+$icon = elgg_view(
+               "profile/icon", array(
+                                                               'entity' => $vars['entity'],
+                                                               'size' => 'tiny',
+                                                         )
+);
+                       
+$banned = $vars['entity']->isBanned();
+       
+// Simple XFN
+$rel = "";
+if (page_owner() == $vars['entity']->guid)
+       $rel = 'me';
+else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
+       $rel = 'friend';
+               
+if (!$banned) {
+       $info .= "<p class='entity_title user'><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></p>";
+       //create a view that a status plugin could extend - in the default case, this is the wire
+       $info .= elgg_view("profile/status", array("entity" => $vars['entity']));
+       $location = $vars['entity']->location;
+       if (!empty($location)) {
+               $info .= "<p class='entity_subtext user'>" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
+       }
+}else{
+       $info .= "<p class='entity_title user banned'>";
+       if (isadminloggedin())
+               $info .= "<a href=\"" . $vars['entity']->getUrl() . "\">";
+       $info .= $vars['entity']->name;
+       if (isadminloggedin())
+               $info .= "</a>";
+       $info .= "</p>";
+}
+               
+echo elgg_view_listing($icon, $info);
\ No newline at end of file
index 7ca1d84d54a103959c2449a5629b091f076f61ca..4ce7c89b6b83734f630c56f87b594e9f51eb5593 100644 (file)
@@ -1,29 +1,32 @@
 <?php
+/**
+ * Elgg profile icon hover over: actions
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
+ */
 
-       /**
-        * Elgg profile icon hover over: actions
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
-        */
-
-       if (isloggedin()) {
-               if ($_SESSION['user']->getGUID() != $vars['entity']->getGUID()) {
-                       
-                       $ts = time();
-                       $token = generate_action_token($ts);
-                                       
-                       if ($vars['entity']->isFriend()) {
-                               echo "<p class=\"user_menu_removefriend\"><a href=\"{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}&__elgg_token=$token&__elgg_ts=$ts\">" . elgg_echo("friend:remove") . "</a></p>";
-                       } else {
-                               echo "<p class=\"user_menu_addfriend\"><a href=\"{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}&__elgg_token=$token&__elgg_ts=$ts\">" . elgg_echo("friend:add") . "</a></p>";
-                       }
+if (isloggedin()) {
+       if ($_SESSION['user']->getGUID() != $vars['entity']->getGUID()) {
+               $ts = time();
+               $token = generate_action_token($ts);
+               if ($vars['entity']->isFriend()) {
+                       echo elgg_view('output/confirm_link', array(
+                               'href' => "{$vars['url']}action/friends/remove?friend={$vars['entity']->getGUID()}",
+                               'text' => elgg_echo('friend:remove'),
+                               'class' => 'user_menu_removefriend'
+                       ));
+               } else {
+                       echo elgg_view('output/confirm_link', array(
+                               'href' => "{$vars['url']}action/friends/add?friend={$vars['entity']->getGUID()}",
+                               'text' => elgg_echo('friend:add'),
+                               'class' => 'user_menu_removefriend'
+                       ));
                }
        }
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 7d0c24cb4b81ad713bf8267426191f3b909a68e5..a88f968167474b62f5184d613cdb5f3e6758fd77 100644 (file)
@@ -1,40 +1,32 @@
 <?php
-       /**
       * Profile admin context links
       
       * @package ElggProfile
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Curverider Ltd
       * @copyright Curverider Ltd 2008-2010
       * @link http://elgg.com/
       
       * @uses $vars['entity'] The user entity
       */
+/**
+ * Profile admin context links
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity
+ */
 
-                       if (isadminloggedin()){
-                               if ($_SESSION['id']!=$vars['entity']->guid){
-                                       
-                                       $ts = time();
-                                       $token = generate_action_token($ts);
-                                       
+if (isadminloggedin()){
+       if ($_SESSION['id']!=$vars['entity']->guid){
 ?>
-                               <a href="<?php echo $vars['url']; ?>pg/settings/user/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo('profile:editdetails'); ?></a>
-                               <?php 
-                               if (!$vars['entity']->isBanned()) {
-                                       echo elgg_view('output/confirmlink', array('text' => elgg_echo("ban"), 'href' => "{$vars['url']}action/admin/user/ban?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts"));
-                               } else {
-                                       echo elgg_view('output/confirmlink', array('text' => elgg_echo("unban"), 'href' => "{$vars['url']}action/admin/user/unban?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts")); 
-                               }
-                               
-                               echo elgg_view('output/confirmlink', array('text' => elgg_echo("delete"), 'href' => "{$vars['url']}action/admin/user/delete?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts"));
-
-                               echo elgg_view('output/confirmlink', array('text' => elgg_echo("resetpassword"), 'href' => "{$vars['url']}action/admin/user/resetpassword?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts"));
-                               
-                               if (!$vars['entity']->admin) { 
-                                       echo elgg_view('output/confirmlink', array('text' => elgg_echo("makeadmin"), 'href' => "{$vars['url']}action/admin/user/makeadmin?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts"));
-                               } else {
-                                       echo elgg_view('output/confirmlink', array('text' => elgg_echo("removeadmin"), 'href' => "{$vars['url']}action/admin/user/removeadmin?guid={$vars['entity']->guid}&__elgg_token=$token&__elgg_ts=$ts"));
-                               }
+               <a href="<?php echo $vars['url']; ?>pg/settings/user/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo('profile:editdetails'); ?></a>
+<?php 
+                       if (!$vars['entity']->isBanned()) {
+                               echo elgg_view('output/confirmlink', array('text' => elgg_echo("ban"), 'href' => "{$vars['url']}action/admin/user/ban?guid={$vars['entity']->guid}"));
+                       } else {
+                               echo elgg_view('output/confirmlink', array('text' => elgg_echo("unban"), 'href' => "{$vars['url']}action/admin/user/unban?guid={$vars['entity']->guid}")); 
+                       }
+                       echo elgg_view('output/confirmlink', array('text' => elgg_echo("delete"), 'href' => "{$vars['url']}action/admin/user/delete?guid={$vars['entity']->guid}"));
+                       echo elgg_view('output/confirmlink', array('text' => elgg_echo("resetpassword"), 'href' => "{$vars['url']}action/admin/user/resetpassword?guid={$vars['entity']->guid}"));
+                       if (!$vars['entity']->admin) { 
+                               echo elgg_view('output/confirmlink', array('text' => elgg_echo("makeadmin"), 'href' => "{$vars['url']}action/admin/user/makeadmin?guid={$vars['entity']->guid}"));
+                       } else {
+                               echo elgg_view('output/confirmlink', array('text' => elgg_echo("removeadmin"), 'href' => "{$vars['url']}action/admin/user/removeadmin?guid={$vars['entity']->guid}"));
                        }
                }
-?>
\ No newline at end of file
+       }
\ No newline at end of file
index 2acbb35e89e6c7a21619c4d00edaba372946f9e7..b60eec46276a1cce3947dbda6aa7810516d1c88b 100644 (file)
@@ -1,11 +1,17 @@
 <?php
+/**
+ * Wraps the admin links
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ */
 
-       $adminlinks = elgg_view('profile/menu/adminlinks',$vars);
+$adminlinks = elgg_view('profile/menu/adminlinks', $vars);
 
-       if (!empty($adminlinks)) {
-
-               echo "<p class=\"user_menu_admin\">{$adminlinks}</p>";
-               
-       }
-       
-?>
\ No newline at end of file
+if (!empty($adminlinks)) {
+       echo "<p class=\"user_menu_admin\">{$adminlinks}</p>";
+}
\ No newline at end of file
index 8aa5e1a1abae0c7bc4b931bd89a5872d2b6ae5d4..ce82df10a845593179a4a138d55ee81e7dd3ad94 100644 (file)
@@ -1,36 +1,32 @@
 <?php
-
-       /**
-        * Elgg profile icon hover over: passive links
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
-        */
-
+/**
+ * Elgg profile icon hover over: passive links
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
+ */
 ?>
 
-       <p class="user_menu_profile">
-               <a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo elgg_echo("profile"); ?></a>
-       </p>
-       <?php
-               if ($vars['entity']->canEdit())
-               {
-       ?>
+<p class="user_menu_profile">
+       <a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo elgg_echo("profile"); ?></a>
+</p>
+<?php
+       if ($vars['entity']->canEdit()){
+?>
                <p class="user_menu_profile">
-                       <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/editicon/"><?php echo elgg_echo("profile:editicon"); ?></a>
+                       <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/icon"><?php echo elgg_echo("profile:editicon"); ?></a>
                </p>
-       <?php
-               }
-       
-       ?>
-       <p class="user_menu_friends">
-               <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a>       
-       </p>
-       <p class="user_menu_friends_of">
-               <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a>  
-       </p>
\ No newline at end of file
+<?php
+       }
+?>
+<p class="user_menu_friends">
+       <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a>       
+</p>
+<p class="user_menu_friends_of">
+       <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a>  
+</p>
index 08aece082cd8712957e66a4fc667ac7d918c9213..58eb3e1a06f74f1441829435a909e0cdb5542e9a 100644 (file)
@@ -1,33 +1,29 @@
 <?php
-
-       /**
-        * Elgg profile icon / profile links: passive links when looking at your own icon / profile
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
-        */
-
+/**
+ * Elgg profile icon / profile links: passive links when looking at your own icon / profile
+ * 
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
+ */
+?>
+<?php
+       if ($vars['entity']->canEdit()){
 ?>
-       <?php
-               if ($vars['entity']->canEdit())
-               {
-       ?>
                <p class="user_menu_profile">
-                       <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/editicon/"><?php echo elgg_echo("profile:editicon"); ?></a>
+                       <a href="<?php echo $vars['url']?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/icon"><?php echo elgg_echo("profile:editicon"); ?></a>
                </p>
-       <?php
-               }
+<?php
+       }
+?>
+<p class="user_menu_friends">
+       <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a>       
+</p>
+<p class="user_menu_friends_of">
+       <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a>  
+</p>
        
-       ?>
-       <p class="user_menu_friends">
-               <a href="<?php echo $vars['url']; ?>pg/friends/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends"); ?></a>       
-       </p>
-       <p class="user_menu_friends_of">
-               <a href="<?php echo $vars['url']; ?>pg/friendsof/<?php echo $vars['entity']->username; ?>/"><?php echo elgg_echo("friends:of"); ?></a>  
-       </p>
-       
\ No newline at end of file
index a6981c4c9909cd82b5cd0d207e9b8f37e6f8b61d..0039281f0c32c3e02814d37782e9bc0e5d240cdb 100644 (file)
@@ -1,21 +1,15 @@
 <?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 Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        */
-
-       /*
-        * <script type="text/javascript" src="<?php echo $vars['url']; ?>pg/iconjs/profile.js" ></script>
-        */
-
-?>
-
-       <?php if ($owner = page_owner_entity()) { ?><link rel="meta" type="application/rdf+xml" title="FOAF" href="<?php echo full_url(); ?>?view=foaf" /><?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 Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ * 
+ */
+
+if ($owner = page_owner_entity()) { ?>
+       <link rel="meta" type="application/rdf+xml" title="FOAF" href="<?php echo full_url(); ?>?view=foaf" />
+<?php } ?>
\ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/activity.php b/mod/profile/views/default/profile/profile_contents/activity.php
new file mode 100755 (executable)
index 0000000..62fc747
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Elgg user display (details)
+ * @uses $vars['entity'] The user entity
+ */
+?>     
+<div id="profile_content">
+       <?php
+       if(is_plugin_enabled('thewire')) {
+               // users last status msg, if they posted one
+               echo elgg_view("profile/status", array("entity" => $vars['entity']));
+       }
+       if(is_plugin_enabled('riverdashboard')) {
+               // users last 10 activites
+               echo elgg_view('profile/profile_contents/profile_activity', array('entity' => $vars['entity']));
+       } else {
+               echo "Riverdashboard not loaded";
+       }
+       ?>
+</div>
+
+<div id="profile_sidebar">
+<?php
+       echo elgg_view('profile/profile_ownerblock', array('smallicon' => true));
+?>
+</div>
diff --git a/mod/profile/views/default/profile/profile_contents/details.php b/mod/profile/views/default/profile/profile_contents/details.php
new file mode 100755 (executable)
index 0000000..c613799
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Elgg user display (details)
+ * @uses $vars['entity'] The user entity
+ */
+?>
+<div id="profile_content">
+<?php
+       // Simple XFN
+       $rel = "";
+       if (page_owner() == $vars['entity']->guid)
+               $rel = 'me';
+       else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
+               $rel = 'friend';
+
+       if ($vars['full'] == true) {
+               $even_odd = null;
+               if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0)
+                       foreach($vars['config']->profile as $shortname => $valtype) {
+                               if ($shortname != "description") {
+                                       $value = $vars['entity']->$shortname;
+                                       if (!empty($value)) {
+                                               //This function controls the alternating class
+                                       $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';                                    
+?>
+                                               <p class="<?php echo $even_odd; ?>">
+                                               <b><?php
+                                                               echo elgg_echo("profile:{$shortname}");
+                                               ?>: </b>
+                                               <?php
+                                                       echo elgg_view("output/{$valtype}",array('value' => $vars['entity']->$shortname));
+                                               ?>
+                                               </p>
+                                               <?php
+                                       }
+                               }
+                       }
+       }
+?>
+<?php 
+       if (!get_plugin_setting('user_defined_fields', 'profile')) {
+?>
+<?php 
+               if ($vars['entity']->isBanned()) {
+                       echo "<div class='banned_user'>";
+                       echo elgg_echo('profile:banned');
+                       echo "</div>";
+                }else{ 
+                        if($vars['entity']->description){
+                               echo "<p class='aboutme_title'><b>" . elgg_echo("profile:aboutme") . "</b></p>";
+                               echo "<div class='aboutme_contents'>" .elgg_view('output/longtext', array('value' => $vars['entity']->description))."</div>";
+                       }
+       ?>
+<?php } ?>
+       <?php 
+               }
+               
+       echo "</div>";
+       // profile sidebar
+       echo "<div id='profile_sidebar'>";
+       echo elgg_view('profile/profile_ownerblock');
+       echo "</div>";
+?>
diff --git a/mod/profile/views/default/profile/profile_contents/friends.php b/mod/profile/views/default/profile/profile_contents/friends.php
new file mode 100755 (executable)
index 0000000..4fa290a
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Profile friends
+ **/
+
+$friends = list_entities_from_relationship('friend',$vars['entity']->getGUID(),false,'user','',0,10,false);
+if(!$friends)
+       $friends = "<p>This user has not made any friends yet.</p>";
+
+?>
+<div id="profile_content">
+       <?php
+               echo $friends;
+       ?>
+</div>
+
+<div id="profile_sidebar">
+<?php
+       echo elgg_view('profile/profile_ownerblock', array('smallicon' => true));
+?>
+</div>
\ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/twitter.php b/mod/profile/views/default/profile/profile_contents/twitter.php
new file mode 100755 (executable)
index 0000000..75b6d04
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Elgg twitter view page
+ */
+        
+$twitter_username = $vars['entity']->twitter;
+        
+// if the twitter username is empty, then do not show
+if($twitter_username){
+?>
+<div id="profile_content">
+       <ul id="twitter_update_list"></ul>
+       <p class="visit_twitter"><a href="http://twitter.com/<?php echo $twitter_username; ?>" target="_blank"><?php echo elgg_echo("twitter:visit"); ?></a></p>
+       <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
+       <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/<?php echo $twitter_username; ?>.json?callback=twitterCallback2&count=10"></script>
+</div>
+<div id="profile_sidebar">
+<?php
+       echo elgg_view('profile/profile_ownerblock', array('smallicon' => true));
+?>
+</div>
+<?php 
+}
+?>
\ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/widgets.php b/mod/profile/views/default/profile/profile_contents/widgets.php
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mod/profile/views/default/profile/profile_navigation.php b/mod/profile/views/default/profile/profile_navigation.php
new file mode 100755 (executable)
index 0000000..0ab0074
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+
+$section = 'activity';
+if (isset($vars['section'])) {
+       $section = $vars['section'];
+}
+
+$profile = $vars['entity'];
+$activity = '';
+$widgets = '';
+$friends = '';
+$extend = '';
+$twitter = '';
+
+$url = "{$profile->getURL()}/";
+
+//select section 
+switch($section){
+       case 'friends':
+               $friends = 'class="selected"';
+               break;
+
+       case 'widgets':
+               $widgets = 'class="selected"';
+               break;
+
+       case 'details':
+               $details = 'class="selected"';
+               break;
+
+       case 'twitter':
+               $twitter = 'class="selected"';
+               break;
+
+       case 'activity':
+       default:
+               $activity = 'class="selected"';
+               break;
+}
+?>
+<div class="elgg_horizontal_tabbed_nav profile">
+<div class="profile_name"><h2><?php echo $profile->name; ?></h2></div>
+<ul>
+       <li <?php echo $activity; ?>><a href="<?php echo $url; ?>">Activity</a></li>
+       <li <?php echo $details; ?>><a href="<?php echo $url . 'details'; ?>">Details</a></li>
+       <li <?php echo $widgets; ?>><a href="<?php echo $url . 'widgets'; ?>">Widgets</a></li>
+       <li <?php echo $friends; ?>><a href="<?php echo $url . 'friends'; ?>">Friends</a></li>
+       <?php
+               //check to see if the twitter username is set
+               if($vars['entity']->twitter){
+       ?>
+                       <li <?php echo $twitter; ?>><a href="<?php echo $url . 'twitter'; ?>">Twitter</a></li>
+       <?php
+               }
+       ?>
+</ul>
+</div>
diff --git a/mod/profile/views/default/profile/profile_ownerblock.php b/mod/profile/views/default/profile/profile_ownerblock.php
new file mode 100755 (executable)
index 0000000..c5cb901
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+
+/**
+ * A simple owner block which houses info about the user whose 'stuff' you are looking at
+ */
+//get the page owner
+if($vars['entity']){
+       if($vars['context'] == 'edit')
+               $user = get_entity($vars['entity']->container_guid);
+       else
+               $user = get_entity($vars['entity']->guid);
+}else{
+       $user = page_owner_entity();
+}
+$more_info = '';
+//set some variables
+$location = elgg_view("output/tags",array('value' => $user->location));
+if($vars['smallicon'] != true){
+       $icon = elgg_view("profile/icon",array('entity' => $user, 'size' => 'large', 'override' => 'true'));
+       $icon_class = "large";
+}else{
+       $icon = elgg_view("profile/icon",array('entity' => $user, 'size' => 'small'));
+       $more_info = "<div class='owner_block_contents clearfloat'>";
+       $more_info .= "<h3><a href='{$url}'>{$user->name}</a></h3>";
+       $more_info .= "<p class='profile_info briefdescription'>{$user->briefdescription}</p>";
+       $more_info .= "<p class='profile_info location'>{$location}</p>";
+       $more_info .= "</div>";
+}
+$profile_actions = "";
+if(get_loggedin_user()->getGuid() == page_owner()){
+       $profile_actions = "<div class='clearfloat profile_actions'>";
+       $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/details' class='action_button'>Edit profile</a>";
+       $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/icon' class='action_button'>Edit profile icon</a>";
+       $profile_actions .= "</div>";
+}else{
+       $profile_actions = "<div class='profile_actions'>";
+       if (isloggedin()) {
+               if ($_SESSION['user']->getGUID() != $user->getGUID()) {
+                       $ts = time();
+                       $token = generate_action_token($ts);
+                                       
+                       if ($user->isFriend()) {
+                               $profile_actions .= "<a href=\"{$vars['url']}action/friends/remove?friend={$user->getGUID()}&__elgg_token=$token&__elgg_ts=$ts\" class='action_button'>" . elgg_echo('friend:remove') . "</a>";
+                       } else {
+                               $profile_actions .= "<a href=\"{$vars['url']}action/friends/add?friend={$user->getGUID()}&__elgg_token=$token&__elgg_ts=$ts\" class='action_button'>" . elgg_echo('friend:add') . "</a>";
+                       }
+               }
+       }
+       if(is_plugin_enabled('messages')){
+               $profile_actions .= "<a href=\"{$vars['url']}mod/messages/send.php?send_to={$user->guid}\" class='action_button'>". elgg_echo('messages:send') ."</a>";
+       }
+       $profile_actions .= "</div>";
+}
+
+$username = $user->username;
+$email = $user->email;
+$phone = $user->phone;
+       
+//get correct links
+$url = $vars['url'];
+
+//if admin display admin links
+if(isadminloggedin()){
+       $admin_links = elgg_view('profile/admin_menu');
+}else{
+       $admin_links = '';
+}
+
+
+//check tools are enabled
+if(is_plugin_enabled('file')){
+       $file_link = "<li {$file_highlight}><a href=\"{$vars['url']}pg/file/{$username}\">Files</a></li>";
+}else{
+       $file_link = "";
+}
+if(is_plugin_enabled('blog')){
+       $blog_link = "<li {$blog_highlight}><a href=\"{$vars['url']}pg/blog/{$username}\">Blog</a></li>";
+}else{
+       $blog_link = "";
+}
+if(is_plugin_enabled('video')){
+       $video_link = "<li {$video_highlight}><a href=\"{$vars['url']}pg/video/{$username}\">Videos</a></li>";
+}else{
+       $video_link = "";
+}
+if(is_plugin_enabled('pages')){
+       $pages_link = "<li {$pages_highlight}><a href=\"{$vars['url']}pg/pages/owned/{$username}\">Pages</a></li>";
+}else{
+       $pages_link = "";
+}
+if(is_plugin_enabled('bookmarks')){
+       $bookmark_link = "<li {$bookmarks_highlight}><a href=\"{$vars['url']}pg/bookmarks/{$username}\">Bookmarks</a></li>";
+}else{
+       $bookmark_link = "";
+}
+
+
+
+//contruct the display
+$display = <<<EOT
+
+<div id="owner_block">
+       <div class="owner_block_icon {$icon_class}">
+               {$icon}
+       </div>
+       {$more_info}
+       {$profile_actions}
+       <div class="owner_block_links">
+               <ul>
+               {$file_link}
+               {$blog_link}
+               {$video_link}
+               {$bookmark_link}
+               {$pages_link}
+               </ul>
+       </div>
+       <!-- if admin user -->
+       {$admin_links}  
+</div>
+       
+EOT;
+
+echo $display;
diff --git a/mod/profile/views/default/profile/profilelinks.php b/mod/profile/views/default/profile/profilelinks.php
deleted file mode 100644 (file)
index 6f35620..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-       /**
-        * Elgg profile links
-        * We need to make sure that the correct links display depending on whether you are looking at your own 
-        * profile or someone else's
-        * 
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        * 
-        * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. 
-        */
-
-?>
-
-<?php
-
-       $banned = false;
-       $owner = page_owner_entity();
-       if ($owner) $banned = $owner->isBanned();
-
-       // Allow menus if not banned or admin logged in
-       if ((!$banned) || (isadminloggedin()))
-       {
-           //check to see if the user is looking at their own profile
-           if ($_SESSION['user']->guid == page_owner()){
-       
-               echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
-                   echo elgg_view("profile/menu/actions",$vars);//grab action links such as make friend
-                   echo elgg_view("profile/menu/linksownpage",$vars); // an different view for user's own profile
-                   echo "</div>"; //close wrapper div 
-                   
-           } else {
-               
-               echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
-               echo elgg_view("profile/menu/actions",$vars); //grab action links such as make friend
-                   echo elgg_view("profile/menu/links",$vars); //passive links to items such as user blog etc
-                   echo "</div>"; //close wrapper div 
-                   
-           }
-       }
-       else
-       {       // Some nice spacing
-               echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
-           echo "</div>"; //close wrapper div 
-       }
-?>
\ No newline at end of file
diff --git a/mod/profile/views/default/profile/userdetails.php b/mod/profile/views/default/profile/userdetails.php
deleted file mode 100644 (file)
index eb22a70..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-
-       /**
-        * Elgg user display (details)
-        *
-        * @package ElggProfile
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        *
-        * @uses $vars['entity'] The user entity
-        */
-
-       if ($vars['full'] == true) {
-               $iconsize = "large";
-       } else {
-               $iconsize = "medium";
-       }
-
-       // wrap all profile info
-       echo "<div id=\"profile_info\">";
-
-?>
-
-<table cellspacing="0">
-<tr>
-<td>
-
-<?php
-
-       // wrap the icon and links in a div
-       echo "<div id=\"profile_info_column_left\">";
-
-       echo "<div id=\"profile_icon_wrapper\">";
-       // get the user's main profile picture
-       echo elgg_view(
-                                               "profile/icon", array(
-                                                                                               'entity' => $vars['entity'],
-                                                                                               //'align' => "left",
-                                                                                               'size' => $iconsize,
-                                                                                               'override' => true,
-                                                                                       )
-                                       );
-
-
-       echo "</div>";
-       echo "<div class=\"clearfloat\"></div>";
-       // display relevant links
-       echo elgg_view("profile/profilelinks", array("entity" => $vars['entity']));
-
-       // close profile_info_column_left
-       echo "</div>";
-
-?>
-</td>
-<td>
-
-       <div id="profile_info_column_middle" >
-                       <?php
-
-               if ($vars['entity']->canEdit()) {
-
-       ?>
-               <p class="profile_info_edit_buttons">
-                       <a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/"><?php echo elgg_echo("profile:edit"); ?></a>
-               </p>
-       <?php
-
-               }
-
-       ?>
-
-
-
-       <?php
-
-       // Simple XFN
-       $rel = "";
-       if (page_owner() == $vars['entity']->guid)
-               $rel = 'me';
-       else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
-               $rel = 'friend';
-
-       // display the users name
-       echo "<h2><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></h2>";
-
-       //insert a view that can be extended
-       echo elgg_view("profile/status", array("entity" => $vars['entity']));
-
-               if ($vars['full'] == true) {
-
-       ?>
-       <?php
-               $even_odd = null;
-
-               if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0)
-                       foreach($vars['config']->profile as $shortname => $valtype) {
-                               if ($shortname != "description") {
-                                       $value = $vars['entity']->$shortname;
-                                       if (!empty($value)) {
-
-                                               //This function controls the alternating class
-                                               $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
-
-                                               ?>
-                                               <p class="<?php echo $even_odd; ?>">
-                                                       <b><?php
-
-                                                       echo elgg_echo("profile:{$shortname}");
-
-                                                       ?>: </b>
-                                                       <?php
-                                                       $options = array(
-                                                               'value' => $vars['entity']->$shortname
-                                                       );
-
-                                                       if ($valtype == 'tags') {
-                                                               $options['tag_names'] = $shortname;
-                                                       }
-
-                                                       echo elgg_view("output/{$valtype}", $options);
-
-                                                       ?>
-
-                                               </p>
-
-                                               <?php
-                                       }
-                               }
-                       }
-               }
-
-       ?>
-       </div><!-- /#profile_info_column_middle -->
-
-</td>
-</tr>
-<?php if (!get_plugin_setting('user_defined_fields', 'profile')) {?>
-<tr>
-<td colspan="2">
-       <div id="profile_info_column_right">
-       <p class="profile_aboutme_title"><b><?php echo elgg_echo("profile:aboutme"); ?></b></p>
-
-       <?php if ($vars['entity']->isBanned()) { ?>
-               <div id="profile_banned">
-               <?php
-                       echo elgg_echo('profile:banned');
-               ?>
-               </div><!-- /#profile_info_column_right -->
-
-       <?php } else { ?>
-
-               <?php
-               echo elgg_view('output/longtext', array('value' => $vars['entity']->description));
-               //echo autop(filter_tags($vars['entity']->description));
-               ?>
-
-       <?php } ?>
-
-       </div><!-- /#profile_info_column_right -->
-
-</td>
-
-
-
-</tr>
-<?php } ?>
-
-</table>
-
-
-
-</div><!-- /#profile_info -->
index 2aa0933b6c5cd7a81c91bf1bee917442e927eb06..ebe13e59adbe964a07e5bf92bbff86b55cc73e5b 100644 (file)
@@ -3,10 +3,6 @@
        $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();
        
        $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
-       $string = sprintf(elgg_echo("profile:river:iconupdate"),$url);
-       $string .= "<div class=\"river_content_display\">";
-       $string .= elgg_view("profile/icon",array('entity' => $performed_by, 'size' => 'small', 'override' => 'true'));         
-       $string .= "</div>";
-?>
-
-<?php echo $string; ?>
\ No newline at end of file
+       $string = "<div class=\"river_content_title\">" . sprintf(elgg_echo("profile:river:update"),$url) ."</div>";
+       
+       echo $string;
\ No newline at end of file
index 9b87d829fab8b916f3b2689bcd60d82db3486f3d..06d2697b0fa281743c18c8f4fd69751a3942a667 100644 (file)
@@ -3,7 +3,7 @@
        $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();
        
        $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
-       $string = sprintf(elgg_echo("profile:river:update"),$url);
+       $string = "<div class=\"river_content_title\">" . sprintf(elgg_echo("profile:river:update"),$url) ."</div>";
        
 ?>