Skip to content

Commit

Permalink
Merge commit 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rledisez committed Jul 25, 2009
2 parents b181707 + 50d6cc0 commit 0aa3ec3
Show file tree
Hide file tree
Showing 31 changed files with 276 additions and 169 deletions.
173 changes: 86 additions & 87 deletions installer/install.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/comment/views/admin_block_recent_comments.html.php
Expand Up @@ -2,7 +2,7 @@
<ul>
<? foreach ($comments as $i => $comment): ?>
<li class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>">
<img src="<?= $comment->author()->avatar_url(32, $theme->theme_url("images/avatar.jpg", true)) ?>"
<img src="<?= $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)) ?>"
class="gAvatar"
alt="<?= p::clean($comment->author_name()) ?>"
width="32"
Expand Down
2 changes: 1 addition & 1 deletion modules/comment/views/admin_comments.html.php
Expand Up @@ -106,7 +106,7 @@ function(data) {
<tr id="gComment-<?= $comment->id ?>" class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>">
<td>
<a href="#">
<img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>"
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
class="gAvatar"
alt="<?= p::clean($comment->author_name()) ?>"
width="40"
Expand Down
2 changes: 1 addition & 1 deletion modules/comment/views/comment.html.php
Expand Up @@ -2,7 +2,7 @@
<li id="gComment-<?= $comment->id; ?>">
<p class="gAuthor">
<a href="#">
<img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>"
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
class="gAvatar"
alt="<?= p::clean($comment->author_name()) ?>"
width="40"
Expand Down
2 changes: 1 addition & 1 deletion modules/comment/views/comments.html.php
Expand Up @@ -10,7 +10,7 @@
<li id="gComment-<?= $comment->id ?>">
<p class="gAuthor">
<a href="#">
<img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>"
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
class="gAvatar"
alt="<?= p::clean($comment->author_name()) ?>"
width="40"
Expand Down
5 changes: 3 additions & 2 deletions modules/gallery/controllers/albums.php
Expand Up @@ -166,7 +166,8 @@ public function _update($album) {
access::required("view", $album);
access::required("edit", $album);

$form = album::get_edit_form($album);
$view = album::get_edit_form($album);
$form = $view->form;
if ($valid = $form->validate()) {
// Make sure that there's not a conflict
if ($album->id != 1 &&
Expand Down Expand Up @@ -202,7 +203,7 @@ public function _update($album) {
} else {
print json_encode(
array("result" => "error",
"form" => $form->__toString()));
"form" => $view->__toString()));
}
}

Expand Down
5 changes: 3 additions & 2 deletions modules/gallery/controllers/movies.php
Expand Up @@ -70,7 +70,8 @@ public function _update($photo) {
access::required("view", $photo);
access::required("edit", $photo);

$form = photo::get_edit_form($photo);
$view = photo::get_edit_form($photo);
$form = $view->form;
if ($valid = $form->validate()) {
// Make sure that there's not a conflict
if (Database::instance()
Expand Down Expand Up @@ -101,7 +102,7 @@ public function _update($photo) {
} else {
print json_encode(
array("result" => "error",
"form" => $form->__toString()));
"form" => $view->__toString()));
}
}

Expand Down
5 changes: 3 additions & 2 deletions modules/gallery/controllers/photos.php
Expand Up @@ -61,7 +61,8 @@ public function _update($photo) {
access::required("view", $photo);
access::required("edit", $photo);

$form = photo::get_edit_form($photo);
$view = photo::get_edit_form($photo);
$form = $view->form;
if ($valid = $form->validate()) {
if ($form->edit_item->filename->value != $photo->name) {
// Make sure that there's not a conflict
Expand Down Expand Up @@ -94,7 +95,7 @@ public function _update($photo) {
} else {
print json_encode(
array("result" => "error",
"form" => $form->__toString()));
"form" => $view->__toString()));
}
}

Expand Down
14 changes: 8 additions & 6 deletions modules/gallery/helpers/album.php
Expand Up @@ -94,9 +94,11 @@ static function get_add_form($parent) {
}

static function get_edit_form($parent) {
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_item")->label(t("Edit Album"));
$view = new View("item_edit.html");
$view->script = array();
$view->form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
$view->form->hidden("_method")->value("put");
$group = $view->form->group("edit_item")->label(t("Edit Album"));

$group->input("title")->label(t("Title"))->value($parent->title);
$group->textarea("description")->label(t("Description"))->value($parent->description);
Expand Down Expand Up @@ -127,11 +129,11 @@ static function get_edit_form($parent) {
"DESC" => t("Descending")))
->selected($parent->sort_order);

module::event("item_edit_form", $parent, $form);
module::event("item_edit_form", $parent, $view);

$group->hidden("type")->value("album");
$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
$view->form->add_rules_from(ORM::factory("item"));
return $view;
}
}
16 changes: 12 additions & 4 deletions modules/gallery/helpers/gallery_quick.php
Expand Up @@ -108,12 +108,20 @@ static function buttons($item, $page_type) {
"href" => url::site("move/browse/$item->id"));
}

if (access::can("edit", $item->parent())) {
$disabledState =
$item->type == "album" && empty($item->album_cover_item_id) ? " ui-state-disabled" : "";
$parent = $item->parent();
if (access::can("edit", $parent)) {
// We can't make this item the highlight if it's an album with no album cover, or if it's
// already the album cover.
if (($item->type == "album" && empty($item->album_cover_item_id)) ||
($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) ||
$parent->album_cover_item_id == $item->id) {
$disabledState = " ui-state-disabled";
} else {
$disabledState = " ";
}
$elements["right"][] = (object)array(
"title" => $cover_title,
"class" => "gButtonLink{$disabledState}",
"class" => "gButtonLink$disabledState",
"icon" => "ui-icon-star",
"href" => url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type"));

Expand Down
14 changes: 8 additions & 6 deletions modules/gallery/helpers/photo.php
Expand Up @@ -135,9 +135,11 @@ static function get_add_form($parent) {
}

static function get_edit_form($photo) {
$form = new Forge("photos/$photo->id", "", "post", array("id" => "gEditPhotoForm"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_item")->label(t("Edit Photo"));
$view = new View("item_edit.html");
$view->script = array();
$view->form = new Forge("photos/$photo->id", "", "post", array("id" => "gEditPhotoForm"));
$view->form->hidden("_method")->value("put");
$group = $view->form->group("edit_item")->label(t("Edit Photo"));
$group->input("title")->label(t("Title"))->value($photo->title);
$group->textarea("description")->label(t("Description"))->value($photo->description);
$group->input("filename")->label(t("Filename"))->value($photo->name)
Expand All @@ -147,11 +149,11 @@ static function get_edit_form($photo) {
->callback("item::validate_no_trailing_period")
->error_messages("no_trailing_period", t("The photo name can't end in \".\""));

module::event("item_edit_form", $photo, $form);
module::event("item_edit_form", $photo, $view);

$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
$view->form->add_rules_from(ORM::factory("item"));
return $view;
}

/**
Expand Down

0 comments on commit 0aa3ec3

Please sign in to comment.