1
0

Merge commit 'gallery3-contrib/master'

This commit is contained in:
rWatcher 2010-04-01 21:40:07 -04:00
commit bd7b614608
5 changed files with 36 additions and 4 deletions

View File

@ -37,9 +37,9 @@ alert("New title: <b>{$album->data->entity->title}</b>");
$photo = Gallery3::factory()
->set("type", "photo")
->set("name", "Sample Photo.jpg")
->set("name", "Sample Photo.png")
->set("title", "Sample Photo")
->set_file("/tmp/foo.jpg")
->set_file("gallery.png")
->create($album->url, $auth);
alert("Uploaded photo: <b>{$photo->url}</b>");
alert("Album members: <b>" . join(", ", $album->data->members) . "</b>");

BIN
client/gallery.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -126,6 +126,11 @@ class register_Controller extends Controller {
print $v;
}
public function change_password($id, $password) {
$user = user::lookup($id);
print $this->_get_change_password_form($user, $password);
}
private function _get_form() {
$minimum_length = module::get_var("user", "mininum_password_length", 5);
$form = new Forge("register/handler", "", "post", array("id" => "g-register-form"));
@ -146,4 +151,31 @@ class register_Controller extends Controller {
$group->submit("")->value(t("Register"));
return $form;
}
/**
* Get the password change form. This code is copied from controllers/users.php. The
* difference is that as this is the first time logging on, the user might not have
* expected that they were going to have to enter the password displayed on the welcome
* page, and didn't make note of it. If we were using the standard change password dialog, the
* user would be screwed as there is no way to go back and get it. So with this dialog,
* we will provide the old password as a hidden field.
*/
private function _get_change_password_form($user, $password) {
$form = new Forge(
"users/change_password/$user->id", "", "post", array("id" => "g-change-password-user-form"));
$group = $form->group("change_password")->label(t("Change your password"));
$group->hidden("old_password")->value($password);
$group->password("password")->label(t("New password"))->id("g-password")
->error_messages("min_length", t("Your new password is too short"));
$group->script("")
->text(
'$("form").ready(function(){$(\'input[name="password"]\').user_password_strength();});');
$group->password("password2")->label(t("Confirm new password"))->id("g-password2")
->matches($group->password)
->error_messages("matches", t("The passwords you entered do not match"));
module::event("user_change_password_form", $user, $form);
$group->submit("")->value(t("Save"));
return $form;
}
}

View File

@ -11,7 +11,7 @@
});
</script>
<div id="g-admin-register" class="g-block">
<h1><?= t("User registration adminstration") ?></h1>
<h1><?= t("User registration administration") ?></h1>
<div id="g-registration-admin" class="g-block-content">
<?= form::open($action, array("method" => "post"), $hidden) ?>
<fieldset>

View File

@ -15,7 +15,7 @@
</p>
<p>
<a href="<?= url::site("form/edit/users/{$user->id}") ?>"
<a href="<?= url::site("register/change_password/{$user->id}/$password") ?>"
title="<?= t("Edit your profile")->for_html_attr() ?>"
id="g-after-install-change-password-link"
class="g-button ui-state-default ui-corners-all">