diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/controllers/admin_theme_options.php | 9 | ||||
-rw-r--r-- | modules/tag/controllers/tags.php | 3 | ||||
-rw-r--r-- | modules/tag/helpers/tag_block.php | 2 | ||||
-rw-r--r-- | modules/tag/helpers/tag_installer.php | 7 | ||||
-rw-r--r-- | modules/tag/module.info | 2 |
5 files changed, 19 insertions, 4 deletions
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); + } + + } } diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index fe6d747b..bf41c4df 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -22,7 +22,8 @@ class Tags_Controller extends Controller { // Far from perfection, but at least require view permission for the root album $album = ORM::factory("item", 1); access::required("view", $album); - print tag::cloud(30); + + print tag::cloud(module::get_var("tag", "tag_cloud_size", 30)); } public function create($item_id) { diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php index 8df58a6e..69a9a1c4 100644 --- a/modules/tag/helpers/tag_block.php +++ b/modules/tag/helpers/tag_block.php @@ -30,7 +30,7 @@ class tag_block_Core { $block->css_id = "g-tag"; $block->title = t("Popular tags"); $block->content = new View("tag_block.html"); - $block->content->cloud = tag::cloud(30); + $block->content->cloud = tag::cloud(module::get_var("tag", "tag_cloud_size", 30)); if ($theme->item() && $theme->page_subtype() != "tag" && access::can("edit", $theme->item())) { $controller = new Tags_Controller(); diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php index 16ad1239..66a78b91 100644 --- a/modules/tag/helpers/tag_installer.php +++ b/modules/tag/helpers/tag_installer.php @@ -36,7 +36,8 @@ class tag_installer { KEY(`tag_id`, `id`), KEY(`item_id`, `id`)) DEFAULT CHARSET=utf8;"); - module::set_version("tag", 2); + module::set_var("tag", "tag_cloud_size", 30); + module::set_version("tag", 3); } static function upgrade($version) { @@ -45,6 +46,10 @@ class tag_installer { $db->query("ALTER TABLE {tags} MODIFY COLUMN `name` VARCHAR(128)"); module::set_version("tag", $version = 2); } + if ($version == 2) { + module::set_var("tag", "tag_cloud_size", 30); + module::set_version("tag", $version = 3); + } } static function uninstall() { diff --git a/modules/tag/module.info b/modules/tag/module.info index 8851d119..d9d34386 100644 --- a/modules/tag/module.info +++ b/modules/tag/module.info @@ -1,3 +1,3 @@ name = "Tags" description = "Allows users to tag photos and albums" -version = 2 +version = 3 |