summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2011-04-23 07:27:02 -0700
committerTim Almdal <tnalmdal@shaw.ca>2011-04-23 07:27:02 -0700
commita1f419435c755500bbd11cb6c48a5bb31f8e6421 (patch)
tree1e673daeb106731abbfd4f8095011538a1c31fe8 /modules
parent4b01676f323fb280ebaa4c041e6894cbb464d8fe (diff)
parent33e4a995aa844ebb523ee85a1584ab0386129f7d (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r--modules/g2_import/controllers/admin_g2_import.php12
-rw-r--r--modules/g2_import/views/admin_g2_import.html.php13
-rw-r--r--modules/gallery/config/locale.php8
-rw-r--r--modules/gallery/helpers/gallery_installer.php10
-rw-r--r--modules/gallery/libraries/Gallery_View.php3
-rw-r--r--modules/gallery/module.info2
-rw-r--r--modules/server_add/helpers/server_add_theme.php16
-rw-r--r--modules/server_add/js/admin.js8
-rw-r--r--modules/server_add/js/server_add.js125
-rw-r--r--modules/server_add/views/admin_server_add.html.php23
10 files changed, 61 insertions, 159 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php
index 55a75a3b..cf68d911 100644
--- a/modules/g2_import/controllers/admin_g2_import.php
+++ b/modules/g2_import/controllers/admin_g2_import.php
@@ -94,6 +94,18 @@ class Admin_g2_import_Controller extends Admin_Controller {
print $view;
}
+ public function autocomplete() {
+ $directories = array();
+ $path_prefix = Input::instance()->get("q");
+ foreach (glob("{$path_prefix}*") as $file) {
+ if (is_dir($file) && !is_link($file)) {
+ $directories[] = $file;
+ }
+ }
+
+ print implode("\n", $directories);
+ }
+
private function _get_import_form() {
$embed_path = module::get_var("g2_import", "embed_path", "");
$form = new Forge(
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index 20b243d5..1094524f 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -1,4 +1,17 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?= $theme->css("jquery.autocomplete.css") ?>
+<?= $theme->script("jquery.autocomplete.js") ?>
+<script type="text/javascript">
+$("document").ready(function() {
+ $("form input[name=embed_path]").autocomplete(
+ "<?= url::site("__ARGS__") ?>".replace("__ARGS__", "admin/g2_import/autocomplete"),
+ {
+ max: 256,
+ loadingClass: "g-loading-small",
+ });
+});
+</script>
+
<div id="g-admin-g2-import" class="g-block">
<h1> <?= t("Gallery 2 import") ?> </h1>
<p>
diff --git a/modules/gallery/config/locale.php b/modules/gallery/config/locale.php
index 0509e45f..13de9098 100644
--- a/modules/gallery/config/locale.php
+++ b/modules/gallery/config/locale.php
@@ -29,14 +29,10 @@
$config['language'] = array('en_US', 'English_United States');
/**
- * Locale timezone. Defaults to use the server timezone.
+ * Locale timezone. Set in 'Advanced' settings, falling back to the server's zone.
* @see http://php.net/timezones
*/
-$config['timezone'] = ini_get('date.timezone');
-if (empty($config['timezone'])) {
- // This is a required field. Pick something as a default.
- $config['timezone'] = "America/Los_Angeles";
-}
+$config['timezone'] = module::get_var("gallery", "timezone", date_default_timezone_get());
// i18n settings
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 20de1fea..83c5ed71 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -311,8 +311,9 @@ class gallery_installer {
module::set_var("gallery", "email_header_separator", serialize("\n"));
module::set_var("gallery", "show_user_profiles_to", "registered_users");
module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");
+ module::set_var("gallery", "timezone", Kohana::config("locale.timezone"));
- module::set_version("gallery", 47);
+ module::set_version("gallery", 48);
}
static function upgrade($version) {
@@ -683,6 +684,13 @@ class gallery_installer {
module::set_var("gallery", "apple_touch_icon_url", "lib/images/apple-touch-icon.png");
module::set_version("gallery", $version = 47);
}
+
+ if ($version == 47) {
+ // Add configuration variable to set timezone. Defaults to the currently
+ // used timezone (from PHP configuration).
+ module::set_var("gallery", "timezone", Kohana::config("locale.timezone"));
+ module::set_version("gallery", $version = 48);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
index 77e3d204..1395686c 100644
--- a/modules/gallery/libraries/Gallery_View.php
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -136,6 +136,9 @@ class Gallery_View_Core extends View {
}
unset($this->combine_queue[$type][$group]);
+ if (empty($this->combine_queue[$type])) {
+ unset($this->combine_queue[$type]);
+ }
if ($type == "css") {
return html::stylesheet("combined/css/$key", "screen,print,projection", true);
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index aa1dc341..807d08fd 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 47
+version = 48
diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php
index 50c050a8..cfca5901 100644
--- a/modules/server_add/helpers/server_add_theme.php
+++ b/modules/server_add/helpers/server_add_theme.php
@@ -24,20 +24,4 @@ class server_add_theme_Core {
. $theme->script("server_add.js");
}
}
-
- static function admin_head($theme) {
- $buf = "";
- if (strpos(Router::$current_uri, "admin/server_add") !== false) {
- $buf .= $theme->css("server_add.css")
- . $theme->css("jquery.autocomplete.css");
- $base = url::site("__ARGS__");
- $csrf = access::csrf_token();
- $buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
-
- $buf .= $theme->script("jquery.autocomplete.js")
- . $theme->script("admin.js");
- }
-
- return $buf;
- }
} \ No newline at end of file
diff --git a/modules/server_add/js/admin.js b/modules/server_add/js/admin.js
deleted file mode 100644
index 9d7bd181..00000000
--- a/modules/server_add/js/admin.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Set up autocomplete on the server path list
- *
- */
-$("document").ready(function() {
- $("#g-path").autocomplete(
- base_url.replace("__ARGS__", "admin/server_add/autocomplete"), {max: 256});
-});
diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js
deleted file mode 100644
index 02dda4c0..00000000
--- a/modules/server_add/js/server_add.js
+++ /dev/null
@@ -1,125 +0,0 @@
-(function($) {
- $.widget("ui.gallery_server_add", {
- _init: function() {
- var self = this;
- $("#g-server-add-add-button", this.element).click(function(event) {
- event.preventDefault();
- $(".g-progress-bar", this.element).
- progressbar().
- progressbar("value", 0);
- $("#g-server-add-progress", this.element).slideDown("fast", function() { self.start_add(); });
- });
- $("#g-server-add-pause-button", this.element).click(function(event) {
- self.pause = true;
- $("#g-server-add-pause-button", this.element).hide();
- $("#g-server-add-continue-button", this.element).show();
- });
- $("#g-server-add-continue-button", this.element).click(function(event) {
- self.pause = false;
- $("#g-server-add-pause-button", this.element).show();
- $("#g-server-add-continue-button", this.element).hide();
- self.run_add();
- });
- $("#g-server-add-close-button", this.element).click(function(event) {
- $("#g-dialog").dialog("close");
- window.location.reload();
- });
- $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
- self.open_dir(event);
- });
- $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
- self.select_file(event);
- });
- $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
- self.open_dir(event);
- });
- $("#g-dialog").bind("dialogclose", function(event, ui) {
- window.location.reload();
- });
- },
-
- taskURL: null,
- pause: false,
-
- start_add: function() {
- var self = this;
- var paths = [];
- $.each($("span.selected", self.element), function () {
- paths.push($(this).attr("ref"));
- });
-
- $("#g-server-add-add-button", this.element).hide();
- $("#g-server-add-pause-button", this.element).show();
-
- $.ajax({
- url: START_URL,
- type: "POST",
- async: false,
- data: { "paths[]": paths },
- dataType: "json",
- success: function(data, textStatus) {
- $("#g-status").html(data.status);
- $(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
- self.taskURL = data.url;
- setTimeout(function() { self.run_add(); }, 25);
- }
- });
- return false;
- },
-
- run_add: function () {
- var self = this;
- $.ajax({
- url: self.taskURL,
- async: false,
- dataType: "json",
- success: function(data, textStatus) {
- $("#g-status").html(data.status);
- $(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
- if (data.done) {
- $("#g-server-add-progress", this.element).slideUp();
- $("#g-server-add-add-button", this.element).show();
- $("#g-server-add-pause-button", this.element).hide();
- $("#g-server-add-continue-button", this.element).hide();
- } else {
- if (!self.pause) {
- setTimeout(function() { self.run_add(); }, 25);
- }
- }
- }
- });
- },
-
- /**
- * Load a new directory
- */
- open_dir: function(event) {
- var self = this;
- var path = $(event.target).attr("ref");
- $.ajax({
- url: GET_CHILDREN_URL.replace("__PATH__", path),
- success: function(data, textStatus) {
- $("#g-server-add-tree", self.element).html(data);
- $("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) {
- self.open_dir(event);
- });
- $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
- self.select_file(event);
- });
- }
- });
- },
-
- /**
- * Manage file selection state.
- */
- select_file: function (event) {
- $(event.target).toggleClass("selected");
- if ($("#g-server-add span.selected").length) {
- $("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled");
- } else {
- $("#g-server-add-add-button").enable(false).addClass("ui-state-disabled");
- }
- }
- });
-})(jQuery);
diff --git a/modules/server_add/views/admin_server_add.html.php b/modules/server_add/views/admin_server_add.html.php
index 933ab7f8..474ad428 100644
--- a/modules/server_add/views/admin_server_add.html.php
+++ b/modules/server_add/views/admin_server_add.html.php
@@ -1,4 +1,18 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?= $theme->css("server_add.css") ?>
+<?= $theme->css("jquery.autocomplete.css") ?>
+<?= $theme->script("jquery.autocomplete.js") ?>
+<script type="text/javascript">
+$("document").ready(function() {
+ $("#g-path").autocomplete(
+ "<?= url::site("__ARGS__") ?>".replace("__ARGS__", "admin/server_add/autocomplete"),
+ {
+ max: 256,
+ loadingClass: "g-loading-small",
+ });
+});
+</script>
+
<div class="g-block">
<h1> <?= t("Add from server administration") ?> </h1>
<div class="g-block-content">
@@ -8,12 +22,17 @@
<? if (empty($paths)): ?>
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
<? endif ?>
+
<? foreach ($paths as $id => $path): ?>
<li>
<?= html::clean($path) ?>
- <a href="<?= url::site("admin/server_add/remove_path?path=" . urlencode($path) . "&amp;csrf=$csrf") ?>"
+ <a href="<?= url::site("admin/server_add/remove_path?path=" . urlencode($path) . "&amp;csrf=<?= access::csrf_token() ?>") ?>"
id="icon_<?= $id ?>"
- class="g-remove-dir g-button"><span class="ui-icon ui-icon-trash"><?= t("delete") ?></span></a>
+ class="g-remove-dir g-button">
+ <span class="ui-icon ui-icon-trash">
+ <?= t("delete") ?>
+ </span>
+ </a>
</li>
<? endforeach ?>
</ul>