From 7d98d4b7b9d16f32ed98c8eeb051be4149468dc6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 18 Feb 2010 16:20:59 -0800 Subject: Revert "Fix for ticket #491: Make user and group names translatable." This reverts commit 409121942590e12692eaf4e6e9e8b71bfe5ed60c. --- modules/gallery/views/permissions_form.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/views') diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index b486acb7..f1714119 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -5,7 +5,7 @@ - name)) ?> + name) ?> -- cgit v1.2.3 From 2846d81171c7101e5015995f848d4cc3a9ddebf6 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Thu, 18 Feb 2010 23:00:58 -0700 Subject: First pass at user profile formatting updates. Moved buttons to the top, simplified HTML and CSS. --- modules/gallery/css/gallery.css | 34 +++++++++- modules/gallery/views/user_profile.html.php | 84 ++++++++---------------- modules/gallery/views/user_profile_info.html.php | 2 +- 3 files changed, 62 insertions(+), 58 deletions(-) (limited to 'modules/gallery/views') diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index e06c4dd9..f3e5ec6d 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -55,6 +55,34 @@ margin: 0; } +/* User profile ~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +#g-user-profile h1 { + margin: 1em 0; +} + +#g-user-profile .g-avatar { + margin-right: .6em; +} + +#g-user-profile .g-block { + margin-top: 0; +} + +#g-user-profile .g-block-content { + margin-top: 0; +} + +#g-user-profile th, +#g-user-profile td { + border: none; +} + +#g-user-profile th { + white-space: nowrap; + width: 1%; +} + /** ******************************************************************* * 2) Admin **********************************************************************/ @@ -96,4 +124,8 @@ .rtl #g-block-admin .g-left { margin-left: 1em; margin-right: 0; -} \ No newline at end of file +} + +.rtl #g-user-profile .g-avatar { + margin-left: .6em; +} diff --git a/modules/gallery/views/user_profile.html.php b/modules/gallery/views/user_profile.html.php index 1c346c26..53e8dc1e 100644 --- a/modules/gallery/views/user_profile.html.php +++ b/modules/gallery/views/user_profile.html.php @@ -1,27 +1,4 @@ -
-

- - " - alt="display_name()) ?>" - class="g-avatar" width="40" height="40" /> - - $user->display_name())) ?> -

- -
-
- -
- view ?> -
-
-
- -
- guest && $not_current && !empty($user->email)): ?> - id}") ?>"> - + +

+ " + alt="display_name()) ?>" + class="g-avatar g-left" width="40" height="40" /> + $user->display_name())) ?> +

+ +
+

title) ?>

+
+ view ?> +
+
+
diff --git a/modules/gallery/views/user_profile_info.html.php b/modules/gallery/views/user_profile_info.html.php index 58e134bb..e559abda 100644 --- a/modules/gallery/views/user_profile_info.html.php +++ b/modules/gallery/views/user_profile_info.html.php @@ -2,7 +2,7 @@ $value): ?> - + -- cgit v1.2.3 From 643fffdba0e595e4e3c4777a52088f81bafded40 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 19 Feb 2010 09:49:05 -0800 Subject: Add spaces around %name in the "create a file" text so that double-clicking the token only selects that one word, not the word on the line before (which happens on Chrome/Linux) --- modules/gallery/views/upgrader.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/views') diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index 55731440..c7a96cb5 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -112,7 +112,7 @@

- %name in your %tmp_dir_path directory.", + %name in your %tmp_dir_path directory.", array("name" => "$upgrade_token", "tmp_dir_path" => "gallery3/var/tmp")) ?>

-- cgit v1.2.3 From d388e4bb868602f293b73918981bee1de6176a24 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 19 Feb 2010 11:40:49 -0800 Subject: Refactor away the "display_all" construct in User_Profile_Controller. "display_all" is too coarse, and we should be letting event handlers make the appropriate decision on what to display and when. This duplicates some code, but it's now very clear in the event handlers what's getting shown. Throw a 404 if we try to view the user profile for a missing user. The only feature change in this should be that we now display the name, full name and website for a user to any other registered user, which makes sense since these are typically public fields. Don't show any of the edit buttons unless identity::is_writable() --- modules/gallery/controllers/user_profile.php | 16 +++++----- modules/gallery/helpers/gallery_event.php | 2 +- modules/gallery/views/user_profile.html.php | 4 +-- .../notification/helpers/notification_event.php | 36 +++++++++++++--------- modules/rest/helpers/rest_event.php | 28 +++++++++++------ 5 files changed, 51 insertions(+), 35 deletions(-) (limited to 'modules/gallery/views') diff --git a/modules/gallery/controllers/user_profile.php b/modules/gallery/controllers/user_profile.php index 05373466..b89bc358 100644 --- a/modules/gallery/controllers/user_profile.php +++ b/modules/gallery/controllers/user_profile.php @@ -21,21 +21,21 @@ class User_Profile_Controller extends Controller { public function show($id) { // If we get here, then we should have a user id other than guest. $user = identity::lookup_user($id); - $active_user = identity::active_user(); - $is_current_active = $active_user->id == $id; - $can_edit = $is_current_active && !$active_user->guest; - $display_all = $active_user->admin || $can_edit; + if (!$user) { + throw new Kohana_404_Exception(); + } $v = new Theme_View("page.html", "other", "profile"); $v->page_title = t("%name Profile", array("name" => $user->display_name())); $v->content = new View("user_profile.html"); - // @todo modify user_home to supply a link to their album, $v->content->user = $user; - $v->content->not_current = !$is_current_active; - $v->content->editable = identity::is_writable() && $can_edit; + $v->content->contactable = + !$user->guest && $user->id != identity::active_user()->id && $user->email; + $v->content->editable = + identity::is_writable() && !$user->guest && $user->id == identity::active_user()->id; - $event_data = (object)array("user" => $user, "display_all" => $display_all, "content" => array()); + $event_data = (object)array("user" => $user, "content" => array()); module::event("show_user_profile", $event_data); $v->content->info_parts = $event_data->content; diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index faf1c0c6..36f91142 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -413,7 +413,7 @@ class gallery_event_Core { $fields = array("name" => t("Name"), "locale" => t("Language Preference"), "email" => t("Email"), "full_name" => t("Full name"), "url" => "Web site"); - if (!$data->display_all) { + if (!$data->user->guest) { $fields = array("name" => t("Name"), "full_name" => t("Full name"), "url" => "Web site"); } $v->user_profile_data = array(); diff --git a/modules/gallery/views/user_profile.html.php b/modules/gallery/views/user_profile.html.php index 53e8dc1e..257bd7ca 100644 --- a/modules/gallery/views/user_profile.html.php +++ b/modules/gallery/views/user_profile.html.php @@ -12,18 +12,18 @@ + id}") ?>"> id}") ?>"> - id}") ?>"> - guest && $not_current && !empty($user->email)): ?> + id}") ?>"> diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index c8628ae4..19e8dedb 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -128,23 +128,31 @@ class notification_event_Core { } static function show_user_profile($data) { - if ($data->display_all) { - $view = new View("user_profile_notification.html"); - $view->subscriptions = array(); - foreach(ORM::factory("subscription") - ->where("user_id", "=", $data->user->id) - ->find_all() as $subscription) { - $item = ORM::factory("item") + // Guests don't see comment listings + if (identity::active_user()->guest) { + return; + } + + // Only logged in users can see their comment listings + if (identity::active_user()->id != $data->user->id) { + return; + } + + $view = new View("user_profile_notification.html"); + $view->subscriptions = array(); + foreach(ORM::factory("subscription") + ->where("user_id", "=", $data->user->id) + ->find_all() as $subscription) { + $item = ORM::factory("item") ->where("id", "=", $subscription->item_id) ->find(); - if ($item->loaded()) { - $view->subscriptions[] = (object)array("id" => $subscription->id, "title" => $item->title, - "url" => $item->url()); - } - } - if (count($view->subscriptions) > 0) { - $data->content[] = (object)array("title" => t("Watching"), "view" => $view); + if ($item->loaded()) { + $view->subscriptions[] = (object)array("id" => $subscription->id, "title" => $item->title, + "url" => $item->url()); } } + if (count($view->subscriptions) > 0) { + $data->content[] = (object)array("title" => t("Watching"), "view" => $view); + } } } \ No newline at end of file diff --git a/modules/rest/helpers/rest_event.php b/modules/rest/helpers/rest_event.php index f9aa34e3..c46e65c4 100644 --- a/modules/rest/helpers/rest_event.php +++ b/modules/rest/helpers/rest_event.php @@ -76,19 +76,27 @@ class rest_event { } static function show_user_profile($data) { - if ($data->display_all) { - $view = new View("user_profile_rest.html"); - $key = ORM::factory("user_access_token") + // Guests can't see a REST key + if (identity::active_user()->guest) { + return; + } + + // Only logged in users can see their own REST key + if (identity::active_user()->id != $data->user->id) { + return; + } + + $view = new View("user_profile_rest.html"); + $key = ORM::factory("user_access_token") ->where("user_id", "=", $data->user->id) ->find(); - if (!$key->loaded()) { - $key->user_id = $data->user->id; - $key->access_key = md5($data->user->name . rand()); - $key->save(); - } - $view->rest_key = $key->access_key; - $data->content[] = (object)array("title" => t("Rest api"), "view" => $view); + if (!$key->loaded()) { + $key->user_id = $data->user->id; + $key->access_key = md5($data->user->name . rand()); + $key->save(); } + $view->rest_key = $key->access_key; + $data->content[] = (object)array("title" => t("Rest api"), "view" => $view); } } -- cgit v1.2.3