summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-09-02 23:53:35 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-09-02 23:53:35 -0700
commit3dc7e2e78cab117726385e29d47bb1487b5d755d (patch)
tree1ffd4f0523a6c6b52b8a577dcddcf9fe9a7789d1
parentde61da5bfc9dac7d778f5ca3ff763125a212ec3f (diff)
parent640d84aba46f4dcd813d7c9ade320f665c1958c0 (diff)
Merge branch 'master' into talmdal
-rw-r--r--lib/jquery.autocomplete.css2
-rw-r--r--modules/gallery/controllers/albums.php192
-rw-r--r--modules/gallery/views/admin_maintenance.html.php8
-rw-r--r--themes/admin_default/css/screen.css47
4 files changed, 124 insertions, 125 deletions
diff --git a/lib/jquery.autocomplete.css b/lib/jquery.autocomplete.css
index 4d50cf43..cdf26f56 100644
--- a/lib/jquery.autocomplete.css
+++ b/lib/jquery.autocomplete.css
@@ -36,7 +36,7 @@
}
.ac_loading {
- background: white url('indicator.gif') right center no-repeat;
+ background: white url('../themes/default/images/loading-sm.gif') right center no-repeat;
}
.ac_odd {
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index 627ee052..5f62f798 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -17,102 +17,102 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
- class Albums_Controller extends Items_Controller {
-
- /**
- * @see REST_Controller::_show($resource)
- */
- public function _show($album) {
- $page_size = module::get_var("gallery", "page_size", 9);
- if (!access::can("view", $album)) {
- if ($album->id == 1) {
- $view = new Theme_View("page.html", "login");
- $view->page_title = t("Log in to Gallery");
- $view->content = user::get_login_form("login/auth_html");
- print $view;
- return;
- } else {
- access::forbidden();
- }
- }
-
- $show = $this->input->get("show");
-
- if ($show) {
- $index = $album->get_position($show);
- $page = ceil($index / $page_size);
- if ($page == 1) {
- url::redirect("albums/$album->id");
- } else {
- url::redirect("albums/$album->id?page=$page");
- }
- }
-
- $page = $this->input->get("page", "1");
- $children_count = $album->viewable()->children_count();
- $offset = ($page - 1) * $page_size;
- $max_pages = max(ceil($children_count / $page_size), 1);
-
- // Make sure that the page references a valid offset
- if ($page < 1) {
- url::redirect("albums/$album->id");
- } else if ($page > $max_pages) {
- url::redirect("albums/$album->id?page=$max_pages");
- }
-
- $template = new Theme_View("page.html", "album");
- $template->set_global("page_size", $page_size);
- $template->set_global("item", $album);
- $template->set_global("children", $album->viewable()->children($page_size, $offset));
- $template->set_global("children_count", $children_count);
- $template->set_global("parents", $album->parents());
- $template->content = new View("album.html");
-
- // We can't use math in ORM or the query builder, so do this by hand. It's important
- // that we do this with math, otherwise concurrent accesses will damage accuracy.
- Database::instance()->query(
- "UPDATE {items} SET `view_count` = `view_count` + 1 WHERE `id` = $album->id");
-
- print $template;
- }
-
- /**
- * @see REST_Controller::_create($resource)
- */
- public function _create($album) {
- access::verify_csrf();
- access::required("view", $album);
- access::required("add", $album);
-
- switch ($this->input->post("type")) {
- case "album":
- return $this->_create_album($album);
-
- case "photo":
- return $this->_create_photo($album);
-
- default:
- access::forbidden();
- }
- }
-
- private function _create_album($album) {
- access::required("view", $album);
- access::required("add", $album);
-
- $form = album::get_add_form($album);
- if ($form->validate()) {
- $new_album = album::create(
- $album,
- $this->input->post("name"),
- $this->input->post("title", $this->input->post("name")),
- $this->input->post("description"),
- user::active()->id);
-
- log::success("content", "Created an album",
- html::anchor("albums/$new_album->id", "view album"));
- message::success(t("Created album %album_title",
- array("album_title" => html::purify($new_album->title))));
+class Albums_Controller extends Items_Controller {
+
+ /**
+ * @see REST_Controller::_show($resource)
+ */
+ public function _show($album) {
+ $page_size = module::get_var("gallery", "page_size", 9);
+ if (!access::can("view", $album)) {
+ if ($album->id == 1) {
+ $view = new Theme_View("page.html", "login");
+ $view->page_title = t("Log in to Gallery");
+ $view->content = user::get_login_form("login/auth_html");
+ print $view;
+ return;
+ } else {
+ access::forbidden();
+ }
+ }
+
+ $show = $this->input->get("show");
+
+ if ($show) {
+ $index = $album->get_position($show);
+ $page = ceil($index / $page_size);
+ if ($page == 1) {
+ url::redirect("albums/$album->id");
+ } else {
+ url::redirect("albums/$album->id?page=$page");
+ }
+ }
+
+ $page = $this->input->get("page", "1");
+ $children_count = $album->viewable()->children_count();
+ $offset = ($page - 1) * $page_size;
+ $max_pages = max(ceil($children_count / $page_size), 1);
+
+ // Make sure that the page references a valid offset
+ if ($page < 1) {
+ url::redirect("albums/$album->id");
+ } else if ($page > $max_pages) {
+ url::redirect("albums/$album->id?page=$max_pages");
+ }
+
+ $template = new Theme_View("page.html", "album");
+ $template->set_global("page_size", $page_size);
+ $template->set_global("item", $album);
+ $template->set_global("children", $album->viewable()->children($page_size, $offset));
+ $template->set_global("children_count", $children_count);
+ $template->set_global("parents", $album->parents());
+ $template->content = new View("album.html");
+
+ // We can't use math in ORM or the query builder, so do this by hand. It's important
+ // that we do this with math, otherwise concurrent accesses will damage accuracy.
+ Database::instance()->query(
+ "UPDATE {items} SET `view_count` = `view_count` + 1 WHERE `id` = $album->id");
+
+ print $template;
+ }
+
+ /**
+ * @see REST_Controller::_create($resource)
+ */
+ public function _create($album) {
+ access::verify_csrf();
+ access::required("view", $album);
+ access::required("add", $album);
+
+ switch ($this->input->post("type")) {
+ case "album":
+ return $this->_create_album($album);
+
+ case "photo":
+ return $this->_create_photo($album);
+
+ default:
+ access::forbidden();
+ }
+ }
+
+ private function _create_album($album) {
+ access::required("view", $album);
+ access::required("add", $album);
+
+ $form = album::get_add_form($album);
+ if ($form->validate()) {
+ $new_album = album::create(
+ $album,
+ $this->input->post("name"),
+ $this->input->post("title", $this->input->post("name")),
+ $this->input->post("description"),
+ user::active()->id);
+
+ log::success("content", "Created an album",
+ html::anchor("albums/$new_album->id", "view album"));
+ message::success(t("Created album %album_title",
+ array("album_title" => html::purify($new_album->title))));
print json_encode(
array("result" => "success",
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
index 4bca8653..ce693d73 100644
--- a/modules/gallery/views/admin_maintenance.html.php
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -7,7 +7,7 @@
<div id="gAvailableTasks">
<h2> <?= t("Available Tasks") ?> </h2>
- <table class="gMessages">
+ <table>
<tr>
<th>
<?= t("Name") ?>
@@ -21,7 +21,7 @@
</tr>
<? $i = 0; ?>
<? foreach ($task_definitions as $task): ?>
- <tr class="<?= log::severity_class($task->severity) ?> <?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?>">
+ <tr class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?> <?= log::severity_class($task->severity) ?>">
<td class="<?= log::severity_class($task->severity) ?>">
<?= $task->name ?>
</td>
@@ -69,7 +69,7 @@
</tr>
<? $i = 0; ?>
<? foreach ($running_tasks as $task): ?>
- <tr class="<?= $task->state == "stalled" ? "gWarning" : "" ?> <?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?>">
+ <tr class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?> <?= $task->state == "stalled" ? "gWarning" : "" ?>">
<td class="<?= $task->state == "stalled" ? "gWarning" : "" ?>">
<?= gallery::date_time($task->updated) ?>
</td>
@@ -142,7 +142,7 @@
</tr>
<? $i = 0; ?>
<? foreach ($finished_tasks as $task): ?>
- <tr class="<?= $task->state == "success" ? "gSuccess" : "gError" ?> <?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?>">
+ <tr class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?> <?= $task->state == "success" ? "gSuccess" : "gError" ?>">
<td class="<?= $task->state == "success" ? "gSuccess" : "gError" ?>">
<?= gallery::date_time($task->updated) ?>
</td>
diff --git a/themes/admin_default/css/screen.css b/themes/admin_default/css/screen.css
index 24328133..c81db58d 100644
--- a/themes/admin_default/css/screen.css
+++ b/themes/admin_default/css/screen.css
@@ -356,48 +356,47 @@ li.gError select {
.gInfo,
.gSuccess,
.gWarning {
- background-position: .4em 50%;
- background-repeat: no-repeat;
padding: .4em .5em .4em 30px;
}
-.gError {
- background-color: #f6cbca;
- background-image: url('../images/ico-error.png');
+.gError, tr.gError td.gError {
+ background: #f6cbca url('../images/ico-error.png') no-repeat .4em 50%;
}
.gInfo {
- background-color: #e8e8e8;
- background-image: url('../images/ico-info.png');
+ background: #e8e8e8 url('../images/ico-info.png') no-repeat .4em 50%;
}
.gSuccess {
- background-color: #d9efc2;
- background-image: url('../images/ico-success.png');
+ background: #d9efc2 url('../images/ico-success.png') no-repeat .4em 50%;
}
-.gWarning {
- background-color: #fcf9ce;
- background-image: url('../images/ico-warning.png');
+.gWarning, tr.gWarning td.gWarning {
+ background: #fcf9ce url('../images/ico-warning.png') no-repeat .4em 50%;
+}
+
+.gPager .gInfo,
+tr.gError,
+tr.gInfo,
+tr.gSuccess,
+tr.gWarning {
+ background: none;
}
-table .gError {
- background-color: #f6cbca !important;
+.gInfo td.gInfo {
+ background-color: transparent;
}
-table .gWarning {
- background-color: #fcf9ce !important;
+.gSuccess td.gSuccess {
+ background-color: transparent;
}
-.gPager .gInfo,
-form .gError,
-table .gInfo,
-table .gSuccess {
- background-color: transparent !important;
+.gError td {
+ background-color: #f6cbca;
}
-.gPager .gInfo {
- background-image: none !important;
+.gWarning td {
+ background-color: #fcf9ce;
}
/* Inline layout (forms, lists) ~~~~~~~~~~ */
@@ -643,7 +642,7 @@ li.gGroup {
li.gGroup h4 {
background-color: #eee;
- border-bottom: 1px dashed ccc;
+ border-bottom: 1px dashed #ccc;
padding: .5em 0 .5em .5em;
}
li.gGroup .gButtonLink {