summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/admin_modules.php6
-rw-r--r--modules/gallery/controllers/admin_theme_options.php9
2 files changed, 12 insertions, 3 deletions
diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php
index 787785ea..b712d14f 100644
--- a/modules/gallery/controllers/admin_modules.php
+++ b/modules/gallery/controllers/admin_modules.php
@@ -19,6 +19,9 @@
*/
class Admin_Modules_Controller extends Admin_Controller {
public function index() {
+ // If modules need upgrading, this will get recreated in module::available()
+ site_status::clear("upgrade_now");
+
$view = new Admin_View("admin.html");
$view->page_title = t("Modules");
$view->content = new View("admin_modules.html");
@@ -103,9 +106,6 @@ class Admin_Modules_Controller extends Admin_Controller {
module::event("module_change", $changes);
- // If modules need upgrading, this will get recreated
- site_status::clear("upgrade_now");
-
// @todo this type of collation is questionable from an i18n perspective
if ($activated_names) {
message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php
index cb46da90..a968a56d 100644
--- a/modules/gallery/controllers/admin_theme_options.php
+++ b/modules/gallery/controllers/admin_theme_options.php
@@ -78,8 +78,10 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
$group = $form->group("edit_theme")->label(t("Theme layout"));
$group->input("page_size")->label(t("Items per page"))->id("g-page-size")
->rules("required|valid_digit")
+ ->callback(array($this, "_valididate_page_size"))
->error_messages("required", t("You must enter a number"))
->error_messages("valid_digit", t("You must enter a number"))
+ ->error_messages("valid_min_value", t("The value must be greater than zero"))
->value(module::get_var("gallery", "page_size"));
$group->input("thumb_size")->label(t("Thumbnail size (in pixels)"))->id("g-thumb-size")
->rules("required|valid_digit")
@@ -110,5 +112,12 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
$group->submit("")->value(t("Save"));
return $form;
}
+
+ function _valididate_page_size($input) {
+ if ($input->value < 1) {
+ $input->add_error("valid_min_value", true);
+ }
+
+ }
}