mirror of
https://github.com/Pathduck/gallery3.git
synced 2024-10-29 21:07:18 -04:00
Finish integrating the move of the user edit/update functions into the user module. The premise is that the plugable user module will provide the update screens if the user backend supports updates.
This commit is contained in:
parent
9e833c9443
commit
be6765336e
@ -29,7 +29,6 @@ class Albums_Controller extends Items_Controller {
|
||||
$view = new Theme_View("page.html", "login");
|
||||
$view->page_title = t("Log in to Gallery");
|
||||
$view->content = new View("login_ajax.html");
|
||||
$view->content->writable = user::is_writable();
|
||||
$view->content->form = user::get_login_form("login/auth_html");
|
||||
print $view;
|
||||
return;
|
||||
|
@ -21,7 +21,6 @@ class Login_Controller extends Controller {
|
||||
|
||||
public function ajax() {
|
||||
$view = new View("login_ajax.html");
|
||||
$view->writable = user::is_writable();
|
||||
$view->form = user::get_login_form("login/auth_ajax");
|
||||
print $view;
|
||||
}
|
||||
|
@ -23,6 +23,10 @@ class gallery_event_Core {
|
||||
* Initialization.
|
||||
*/
|
||||
static function gallery_ready() {
|
||||
// Call Identity::instance() now to force the load of the user interface classes.
|
||||
// user::load_user will attempt to load the active user from the session and needs
|
||||
// the user definition class, which can't be reached by Kohana's heiracrchical lookup.
|
||||
Identity::instance();
|
||||
user::load_user();
|
||||
locales::set_request_locale();
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ class gallery_theme_Core {
|
||||
if ($theme->page_type != "login") {
|
||||
$view = new View("login.html");
|
||||
$view->user = user::active();
|
||||
$view->writable = user::is_writable();
|
||||
return $view->render();
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ class user_Core {
|
||||
* driver classes.
|
||||
*/
|
||||
static function load_user() {
|
||||
Identity::instance();
|
||||
$session = Session::instance();
|
||||
if (!($user = $session->get("user"))) {
|
||||
$session->set("user", $user = self::guest());
|
||||
|
@ -102,7 +102,6 @@ class Identity_Core {
|
||||
return !empty($this->config["allow_updates"]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see Identity_Driver::guest.
|
||||
*/
|
||||
|
@ -8,11 +8,15 @@
|
||||
</li>
|
||||
<? else: ?>
|
||||
<li class="first">
|
||||
<? if (user::is_writable()): ?>
|
||||
<?= t('Logged in as %name', array('name' => html::mark_clean(
|
||||
'<a href="' . url::site("form/edit/users/{$user->id}") .
|
||||
'" title="' . ($writable ? t("Edit Your Profile")->for_html_attr() : t("Display Your Profile")->for_html_attr()) .
|
||||
'" title="' . t("Edit Your Profile")->for_html_attr() .
|
||||
'" id="g-user-profile-link" class="g-dialog-link">' .
|
||||
html::clean($user->display_name()) . '</a>'))) ?>
|
||||
<? else: ?>
|
||||
<?= t('Logged in as %name', array('name' => html::clean($user->display_name()))) ?>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= url::site("logout?csrf=$csrf&continue=" . urlencode(url::current(true))) ?>"
|
||||
|
@ -36,7 +36,7 @@
|
||||
<li id="g-login-form">
|
||||
<?= $form ?>
|
||||
</li>
|
||||
<? if (!empty($writable)): ?>
|
||||
<? if (user::is_writable()): ?>
|
||||
<li>
|
||||
<a href="#" id="g-password-reset" class="g-right g-txt-small"><?= t("Forgot Your Password?") ?></a>
|
||||
</li>
|
||||
|
@ -21,7 +21,6 @@ class Admin_Users_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_users.html");
|
||||
$view->content->writable = user::is_writable();
|
||||
$view->content->users = user::get_user_list(array("orderby" => array("name" => "ASC")));
|
||||
$view->content->groups = group::get_group_list(array("orderby" => array("name" => "ASC")));
|
||||
print $view;
|
||||
@ -304,7 +303,7 @@ class Admin_Users_Controller extends Admin_Controller {
|
||||
$group->input("email")->label(t("Email"))->id("g-email")->value($user->email);
|
||||
$group->input("url")->label(t("URL"))->id("g-url")->value($user->url);
|
||||
$group->checkbox("admin")->label(t("Admin"))->id("g-admin")->checked($user->admin);
|
||||
$form->add_rules_from($user);
|
||||
$form->add_rules_from(user::get_edit_rules());
|
||||
$form->edit_user->password->rules("-required");
|
||||
|
||||
module::event("user_edit_form_admin", $user, $form);
|
||||
@ -327,7 +326,7 @@ class Admin_Users_Controller extends Admin_Controller {
|
||||
self::_add_locale_dropdown($group);
|
||||
$group->checkbox("admin")->label(t("Admin"))->id("g-admin");
|
||||
$user = ORM::factory("user");
|
||||
$form->add_rules_from($user);
|
||||
$form->add_rules_from(user::get_edit_rules());
|
||||
|
||||
module::event("user_add_form_admin", $user, $form);
|
||||
$group->submit("")->value(t("Add User"));
|
||||
@ -367,7 +366,7 @@ class Admin_Users_Controller extends Admin_Controller {
|
||||
$form_group->inputs["name"]->error_messages(
|
||||
"in_use", t("There is already a group with that name"));
|
||||
$form_group->submit("")->value(t("Save"));
|
||||
$form->add_rules_from($group);
|
||||
$form->add_rules_from(group::get_edit_rules());
|
||||
return $form;
|
||||
}
|
||||
|
||||
@ -380,7 +379,7 @@ class Admin_Users_Controller extends Admin_Controller {
|
||||
"in_use", t("There is already a group with that name"));
|
||||
$form_group->submit("")->value(t("Add Group"));
|
||||
$group = ORM::factory("group");
|
||||
$form->add_rules_from($group);
|
||||
$form->add_rules_from(group::get_edit_rules());
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ class Users_Controller extends Controller {
|
||||
->matches($group->password);
|
||||
$group->input("email")->label(t("Email"))->id("g-email")->value($user->email);
|
||||
$group->input("url")->label(t("URL"))->id("g-url")->value($user->url);
|
||||
$form->add_rules_from($user);
|
||||
$form->add_rules_from(user::get_edit_rules());
|
||||
|
||||
module::event("user_edit_form", $user, $form);
|
||||
$group->submit("")->value(t("Save"));
|
||||
|
@ -43,14 +43,12 @@
|
||||
}
|
||||
</script>
|
||||
<div class="g-block">
|
||||
<? if (!empty($writable)): ?>
|
||||
<a href="<?= url::site("admin/users/add_user_form") ?>"
|
||||
class="g-dialog-link g-button g-right ui-icon-left ui-state-default ui-corner-all"
|
||||
title="<?= t("Create a new user")->for_html_attr() ?>">
|
||||
<span class="ui-icon ui-icon-circle-plus"></span>
|
||||
<?= t("Add a new user") ?>
|
||||
</a>
|
||||
<? endif ?>
|
||||
|
||||
<h2>
|
||||
<?= t("User Admin") ?>
|
||||
@ -68,7 +66,7 @@
|
||||
|
||||
<? foreach ($users as $i => $user): ?>
|
||||
<tr id="g-user-<?= $user->id ?>" class="<?= text::alternate("g-odd", "g-even") ?> user <?= $user->admin ? "admin" : "" ?>">
|
||||
<td id="user-<?= $user->id ?>" class="core-info <?= !empty($writable) ? "g-draggable" : "" ?> ">
|
||||
<td id="user-<?= $user->id ?>" class="core-info g-draggable">
|
||||
<img src="<?= $user->avatar_url(20, $theme->url("images/avatar.jpg", true)) ?>"
|
||||
title="<?= t("Drag user onto group below to add as a new member")->for_html_attr() ?>"
|
||||
alt="<?= html::clean_attribute($user->name) ?>"
|
||||
@ -90,18 +88,16 @@
|
||||
open_text="<?= t("close") ?>"
|
||||
class="g-panel-link g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-pencil"></span><span class="g-button-text">
|
||||
<?= (!empty($writable)) ? t("edit") : t("display") ?>
|
||||
<?= t("edit") ?>
|
||||
</span></a>
|
||||
<? if (!empty($writable)): ?>
|
||||
<? if (user::active()->id != $user->id && !$user->guest): ?>
|
||||
<a href="<?= url::site("admin/users/delete_user_form/$user->id") ?>"
|
||||
class="g-dialog-link g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span><?= t("delete") ?></a>
|
||||
<? else: ?>
|
||||
<span title="<?= t("This user cannot be deleted")->for_html_attr() ?>"
|
||||
class="g-button ui-state-disabled ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span><?= t("delete") ?></span>
|
||||
<? endif ?>
|
||||
<? if (user::active()->id != $user->id && !$user->guest): ?>
|
||||
<a href="<?= url::site("admin/users/delete_user_form/$user->id") ?>"
|
||||
class="g-dialog-link g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span><?= t("delete") ?></a>
|
||||
<? else: ?>
|
||||
<span title="<?= t("This user cannot be deleted")->for_html_attr() ?>"
|
||||
class="g-button ui-state-disabled ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span><?= t("delete") ?></span>
|
||||
<? endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -111,14 +107,12 @@
|
||||
</div>
|
||||
|
||||
<div id="g-group-admin" class="g-block g-clearfix">
|
||||
<? if (!empty($writable)): ?>
|
||||
<a href="<?= url::site("admin/users/add_group_form") ?>"
|
||||
class="g-dialog-link g-button g-right ui-icon-left ui-state-default ui-corner-all"
|
||||
title="<?= t("Create a new group")->for_html_attr() ?>">
|
||||
<span class="ui-icon ui-icon-circle-plus"></span>
|
||||
<?= t("Add a new group") ?>
|
||||
</a>
|
||||
<? endif ?>
|
||||
|
||||
<h2>
|
||||
<?= t("Group Admin") ?>
|
||||
@ -127,9 +121,8 @@
|
||||
<div class="g-block-content">
|
||||
<ul>
|
||||
<? foreach ($groups as $i => $group): ?>
|
||||
<? $class = !empty($writable) ? "" : "g-group-disable" ?>
|
||||
<li id="group-<?= $group->id ?>" class="g-group <?= $class ?> <?= ($group->special ? "g-default-group" : "") ?>" />
|
||||
<? $v = new View("admin_users_group.html"); $v->group = $group; $v->writable = !empty($writable) ?>
|
||||
<li id="group-<?= $group->id ?>" class="g-group <?= ($group->special ? "g-default-group" : "") ?>" />
|
||||
<? $v = new View("admin_users_group.html"); $v->group = $group; ?>
|
||||
<?= $v ?>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<? if (!$group->special): ?>
|
||||
<a href="<?= url::site("admin/users/delete_group_form/$group->id") ?>"
|
||||
title="<?= t("Delete the %name group", array("name" => $group->name))->for_html_attr() ?>"
|
||||
class="g-dialog-link g-button ui-state-default ui-corner-all <?= !empty($writable) ? "" : "ui-state-disabled" ?>">
|
||||
class="g-dialog-link g-button ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-trash"><?= t("delete") ?></span></a>
|
||||
<? else: ?>
|
||||
<a title="<?= t("This default group cannot be deleted")->for_html_attr() ?>"
|
||||
@ -20,7 +20,7 @@
|
||||
<?= html::clean($user->name) ?>
|
||||
<? if (!$group->special): ?>
|
||||
<a href="javascript:remove_user(<?= $user->id ?>, <?= $group->id ?>)"
|
||||
class="g-button ui-state-default ui-corner-all ui-icon-left <?= !empty($writable) ? "" : "ui-state-disabled" ?>"
|
||||
class="g-button ui-state-default ui-corner-all ui-icon-left"
|
||||
title="<?= t("Remove %user from %group group",
|
||||
array("user" => $user->name, "group" => $group->name))->for_html_attr() ?>">
|
||||
<span class="ui-icon ui-icon-closethick"><?= t("remove") ?></span>
|
||||
|
Loading…
Reference in New Issue
Block a user