Skip to content

Commit

Permalink
Revert "Fix for ticket #491: Make user and group names translatable."
Browse files Browse the repository at this point in the history
This reverts commit 4091219.
  • Loading branch information
bharat committed Feb 19, 2010
1 parent 99c131e commit 7d98d4b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
5 changes: 2 additions & 3 deletions modules/gallery/controllers/user_profile.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public function show($id) {
$user = identity::lookup_user($id); $user = identity::lookup_user($id);
$active_user = identity::active_user(); $active_user = identity::active_user();
$is_current_active = $active_user->id == $id; $is_current_active = $active_user->id == $id;
$can_edit = $is_current_active && !$active_user->guest; $display_all = $active_user->admin || ($is_current_active && !$active_user->guest);
$display_all = $active_user->admin || $can_edit;


$v = new Theme_View("page.html", "other", "profile"); $v = new Theme_View("page.html", "other", "profile");
$v->page_title = t("%name Profile", array("name" => $user->display_name())); $v->page_title = t("%name Profile", array("name" => $user->display_name()));
Expand All @@ -33,7 +32,7 @@ public function show($id) {
// @todo modify user_home to supply a link to their album, // @todo modify user_home to supply a link to their album,
$v->content->user = $user; $v->content->user = $user;
$v->content->not_current = !$is_current_active; $v->content->not_current = !$is_current_active;
$v->content->editable = identity::is_writable() && $can_edit; $v->content->editable = identity::is_writable() && $display_all;


$event_data = (object)array("user" => $user, "display_all" => $display_all, "content" => array()); $event_data = (object)array("user" => $user, "display_all" => $display_all, "content" => array());
module::event("show_user_profile", $event_data); module::event("show_user_profile", $event_data);
Expand Down
3 changes: 0 additions & 3 deletions modules/gallery/helpers/gallery_event.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -423,9 +423,6 @@ static function show_user_profile($data) {
if ($field == "locale") { if ($field == "locale") {
$value = locales::display_name($value); $value = locales::display_name($value);
} }
if ($field == "full_name") {
$value = t($value);
}
$v->user_profile_data[(string) $label] = $value; $v->user_profile_data[(string) $label] = $value;
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/views/permissions_form.html.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<tr> <tr>
<th> </th> <th> </th>
<? foreach ($groups as $group): ?> <? foreach ($groups as $group): ?>
<th> <?= html::clean(t($group->name)) ?> </th> <th> <?= html::clean($group->name) ?> </th>
<? endforeach ?> <? endforeach ?>
</tr> </tr>


Expand Down
8 changes: 4 additions & 4 deletions modules/user/helpers/user_installer.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -98,25 +98,25 @@ static function initialize() {
DEFAULT CHARSET=utf8;"); DEFAULT CHARSET=utf8;");


$everybody = ORM::factory("group"); $everybody = ORM::factory("group");
$everybody->name = t("Everybody", array("locale" => "root")); $everybody->name = "Everybody";
$everybody->special = true; $everybody->special = true;
$everybody->save(); $everybody->save();


$registered = ORM::factory("group"); $registered = ORM::factory("group");
$registered->name = t("Registered Users", array("locale" => "root")); $registered->name = "Registered Users";
$registered->special = true; $registered->special = true;
$registered->save(); $registered->save();


$guest = ORM::factory("user"); $guest = ORM::factory("user");
$guest->name = "guest"; $guest->name = "guest";
$guest->full_name = t("Guest User", array("locale" => "root")); $guest->full_name = "Guest User";
$guest->password = ""; $guest->password = "";
$guest->guest = true; $guest->guest = true;
$guest->save(); $guest->save();


$admin = ORM::factory("user"); $admin = ORM::factory("user");
$admin->name = "admin"; $admin->name = "admin";
$admin->full_name = t("Gallery Administrator", array("locale" => "root")); $admin->full_name = "Gallery Administrator";
$admin->password = "admin"; $admin->password = "admin";
$admin->email = "unknown@unknown.com"; $admin->email = "unknown@unknown.com";
$admin->admin = true; $admin->admin = true;
Expand Down
2 changes: 1 addition & 1 deletion modules/user/models/user.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function save() {
* @return string * @return string
*/ */
public function display_name() { public function display_name() {
return empty($this->full_name) ? $this->name : t($this->full_name); return empty($this->full_name) ? $this->name : $this->full_name;
} }


/** /**
Expand Down
2 changes: 1 addition & 1 deletion modules/user/views/admin_users.html.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class="g-dialog-link g-button g-right ui-icon-left ui-state-default ui-corner-al
<?= html::clean($user->name) ?> <?= html::clean($user->name) ?>
</td> </td>
<td> <td>
<?= t(html::clean($user->full_name)) ?> <?= html::clean($user->full_name) ?>
</td> </td>
<td> <td>
<?= html::clean($user->email) ?> <?= html::clean($user->email) ?>
Expand Down
6 changes: 3 additions & 3 deletions modules/user/views/admin_users_group.html.php
Original file line number Original file line Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?> <?php defined("SYSPATH") or die("No direct script access.") ?>
<h4> <h4>
<?= t(html::clean($group->name)) ?> <?= html::clean($group->name) ?>
<? if (!$group->special): ?> <? if (!$group->special): ?>
<a href="<?= url::site("admin/users/delete_group_form/$group->id") ?>" <a href="<?= url::site("admin/users/delete_group_form/$group->id") ?>"
title="<?= t("Delete the %name group", array("name" => t(html::clean($group->name))))->for_html_attr() ?>" title="<?= t("Delete the %name group", array("name" => $group->name))->for_html_attr() ?>"
class="g-dialog-link g-button g-right"> class="g-dialog-link g-button g-right">
<span class="ui-icon ui-icon-trash"><?= t("Delete") ?></span></a> <span class="ui-icon ui-icon-trash"><?= t("Delete") ?></span></a>
<? else: ?> <? else: ?>
Expand All @@ -22,7 +22,7 @@ class="g-button g-right ui-state-disabled ui-icon-left">
<a href="javascript:remove_user(<?= $user->id ?>, <?= $group->id ?>)" <a href="javascript:remove_user(<?= $user->id ?>, <?= $group->id ?>)"
class="g-button g-right ui-state-default ui-corner-all ui-icon-left" class="g-button g-right ui-state-default ui-corner-all ui-icon-left"
title="<?= t("Remove %user from %group group", title="<?= t("Remove %user from %group group",
array("user" => $user->name, "group" => t(html::clean($group->name))))->for_html_attr() ?>"> array("user" => $user->name, "group" => $group->name))->for_html_attr() ?>">
<span class="ui-icon ui-icon-closethick"><?= t("Remove") ?></span> <span class="ui-icon ui-icon-closethick"><?= t("Remove") ?></span>
</a> </a>
<? endif ?> <? endif ?>
Expand Down

0 comments on commit 7d98d4b

Please sign in to comment.